I'm trying to convert a date from a BJSON to a java timestamp or at least something readable and reliable and I already tweak it with java... the thing is that I have this date in BJSON from mongoDB
ISODate("2019-05-21T07:16:00.599Z")
Obtaining this result in Java returns me:
Tue May 21 09:16:00 CEST 2019
Now I'm going to change it to get the day month and year...
DateTimeFormatter dtf = DateTimeFormatter.ofPattern("EEE MMM d HH:mm:ss zzz uuuu", Locale.US);
ZonedDateTime zdt = ZonedDateTime.parse(updateDate, dtf);
I am getting:
2019-05-21T09:16+02:00[Europe/Paris]
It seems that according to java it is returning me the 09 hours, and 16 minutes and 02 seconds as the final result. However when he returned it to me Tue May 21 09:16:00 CEST 2019
, the seconds were 00.
What am I doing wrong ?
You are not interpreting the data correctly:
This moment is "May 21, 2019, at 7:16 Zulu time . This means UTC+0 , that is, Greenwich Mean Time (although it is no longer said that way, it is Coordinated Universal Time). In Spain, at being summer time (UTC +2), that moment would be the same day but at 9:16 (local time), this time is reflected in the second value you put:
CEST stands for Central Europe Summer Time .
The last value is equivalent:
It tells you that it is May 21 (
2019-05-21
), at 9 and 16 (09:16
, the seconds are omitted), in CEST (+02:00[Europe/Paris]
)