Joda的ISODateTimeFormat文档中表示ISODateTimeFormat.dateTime()
返回一个格式化程序,其模式为yyyy-MM-dd'T'HH:mm:ss.SSSZZ
但是该格式化程序会在+00:00的位置返回"Z"
请参阅以下内容-
DateTime dt = DateTime.now(DateTimeZone.UTC);
DateTimeFormatter patternFormat = DateTimeFormat.forPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZZ");
DateTimeFormatter isoFormat = ISODateTimeFormat.dateTime();
System.out.println(dt.toString(patternFormat)); //2014-06-01T03:02:13.552+00:00
System.out.println(dt.toString(isoFormat)); //2014-06-01T03:02:13.552Z
有人能告诉我获取+00:00的格式打印为Z的模式是什么吗?
编辑: 只想澄清一下,我知道“Z”和“+00:00”是相同的,但在文本上它们是不同的。我的问题是,什么样的模式会将Z作为时间偏移量而不是+00:00。
(如果这太琐碎了,我想使用ISO格式,没有毫秒,并且在写这个问题的过程中,我在ISODateTimeFormat.dateTimeNoMillis()中找到了我想要的东西,所以现在只是出于兴趣问一下)