2010-11-09 70 views
0

清潔的toString我打電話的toString()(或difference.normalizedStandard()。的toString())一期目標,並獲得對 「PT-10H0.317S從JodaTime期

爲什麼默認的toString太不方便了?這個字符串甚至意味着什麼?

回答

2

句柄toString在AbstractPeriod#toString()中定義,其代表ISOPeriodFormat。這裏是JavaDoc:

/** 
* The standard ISO format - PyYmMwWdDThHmMsS. 
* Milliseconds are not output. 
* Note that the ISO8601 standard actually indicates weeks should not 
* be shown if any other field is present and vice versa. 
* 
* @return the formatter 
*/ 

......很明顯,它是ISO 8601標準格式的一段時間。要手動控制輸出,請使用org.joda.time.format.PeriodFormatterBuilder