0

When I use the DateUtils.parseDate method, I need to specify a special time zone, such as ZoneId.of("America/New_York"), to parse the special string into a Date object. Because I like this framework very much, and I hope it becomes more usable. I hope the project team can make the following adjustments:

The DateUtils.parseDateWithLeniency method can open TimeZone and use TimeZone as a method parameter.

Otherwise, I can only use the SimpleDateFormat class in jdk8 to solve my work problem.

 SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
 sdf.setTimeZone(TimeZone.getTimeZone(DatePatternConstants.NEW_YORK_ZONE_ID));
  try {
   long l = sdf.parse(value).getTime() / 1000;

   } catch (ParseException e) {
    throw new RuntimeException(e); 
}
Olaf Kock
  • 46,930
  • 8
  • 59
  • 90
ChildrenGreens
  • 119
  • 1
  • 9

0 Answers0