尝试将java.util.Date转换为java.time.LocalDate时,我收到以下异常。
java.time.DateTimeException: Unable to obtain ZonedDateTime from TemporalAccessor: 2014-08-19T05:28:16.768Z of type java.time.Instant
代码如下:
public static Date getNearestQuarterStartDate(Date calculateFromDate){
int[] quaterStartMonths={1,4,7,10};
Date startDate=null;
ZonedDateTime d=ZonedDateTime.from(calculateFromDate.toInstant());
int frmDateMonth=d.getMonth().getValue();
使用ZonedDateTime类的方式有什么问题吗?
根据文档,这应该将java.util.Date对象转换为ZonedDateTime。上述日期格式是标准日期?
我必须回到乔达时间吗?
如果有人可以提供一些建议,那将是巨大的。