该API用于解析本地日期 http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormatter.html#parseLocalDate%28java.lang.String%29说它会抛出UnsupportedOperationException
“如果不支持解析”。 “如果不支持解析”是什么意思?我正在查看源代码,但找不到任何抛出的地方UnsupportedOperationException
。有没有人遇到过调用抛出此异常的情况parseLocalDate
?
日期时间格式化程序 http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormatter.html有两种用法:
当你创建时DateTimeFormatter 实例 http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeFormatter.html#DateTimeFormatter%28org.joda.time.format.DateTimePrinter,%20org.joda.time.format.DateTimeParser%29,你传递给它日期时间打印机 http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimePrinter.html and 日期时间解析器 http://joda-time.sourceforge.net/apidocs/org/joda/time/format/DateTimeParser.html.
如果你的格式化程序只有printer,而你想要parse date - UnsupportedOperationException
会被抛出。
如果你的格式化程序只有parser,而你想要print date - UnsupportedOperationException
会被抛出。
Example
DateTimeFormatter formatter = new DateTimeFormatter(new DateTimePrinter()
{
// implements all abstract methods
}, null); // this instance has printer and hasn't parser
formatter.print(new DateTime()); // works well
formatter.parseDateTime("datetimestring"); // throws exeption
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)