Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

[Java 8] Problem with DateTimeFormatter

1011641Mar 27 2014 — edited Mar 29 2014

Hi all,

I got a problem with the object DateTimeFormatter.

I receive a date through a webservice which is : Tue Feb 04 14:19:44 EET 2014.

I use this line of code to parse it :

this.sessionExpire_.setValue(LocalDateTime.parse(sessionExpire.toString(), DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss 'EET' yyyy")));


It works on Fedora 20 but it doesn't work on windows 8 and Mac OS.

I get this exception :

Exception in thread "Thread-9" java.time.format.DateTimeParseException: Text 'Tue Feb 04 14:19:44 EET 2014' could not be parsed at index 0

  at java.time.format.DateTimeFormatter.parseResolved0(DateTimeFormatter.java:1948)

  at java.time.format.DateTimeFormatter.parse(DateTimeFormatter.java:1850)

  at java.time.LocalDateTime.parse(LocalDateTime.java:492)

You can try it with this simply with this line :

LocalDateTime.parse("Fri Mar 28 00:08:39 EET 2014", DateTimeFormatter.ofPattern("EEE MMM dd HH:mm:ss 'EET' yyyy"));

It's very weird because I run exactly the same code with exactly the same version of java which is java 8 released (downloaded from oracle's website).

Thanks in advance,

BR

Florian

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 26 2014
Added on Mar 27 2014
1 comment
2,923 views