为什么DateTimeFormatter可以格式化几分之一秒但不能解析它?
如果我不将fmt替换为“ yyyyMMddHHmmss”,则下面的代码将在解析时失败(最后删除SS);
import java.time.*;
import java.time.format.*;
public static void main (String [] args) throws Exception
{
String fmt = "yyyyMMddHHmmssSS";
ZonedDateTime now = ZonedDateTime.now ();
DateTimeFormatter dtf = DateTimeFormatter.ofPattern (fmt).withZone (ZoneOffset.UTC);
String s = dtf.format (now);
ZonedDateTime x = ZonedDateTime.parse (s, dtf);
}
例外是
Text '2018071819500784' could not be parsed at index 0