2010-11-09 71 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