2022-04-05

Working with UTC, Zoned Datetime

 






Java ZonedDateTime to Date


https://stackoverflow.com/a/32274725

You can convert ZonedDateTime to an instant, which you can use directly with Date.

Date.from(java.time.ZonedDateTime.now().toInstant());








https://www.utctime.net/

UTC Date and Time in Various Formats

Date Time FormatUTC Date Time Now
UTC2022-04-05T08:28:33Z
ISO-86012022-04-05T08:28:33+0000
RFC 2822Tue, 05 Apr 2022 08:28:33 +0000
RFC 850Tuesday, 05-Apr-22 08:28:33 UTC
RFC 1036Tue, 05 Apr 22 08:28:33 +0000
RFC 1123Tue, 05 Apr 2022 08:28:33 +0000
RFC 822Tue, 05 Apr 22 08:28:33 +0000
RFC 33392022-04-05T08:28:33+00:00
ATOM2022-04-05T08:28:33+00:00
COOKIETuesday, 05-Apr-2022 08:28:33 UTC
RSSTue, 05 Apr 2022 08:28:33 +0000
W3C2022-04-05T08:28:33+00:00
Unix Epoch1649147313
YYYY-DD-MM HH:MM:SS2022-05-04 08:28:33
YYYY-DD-MM HH:MM:SS am/pm2022-05-04 08:28:33 AM
DD-MM-YYYY HH:MM:SS05-04-2022 08:28:33
MM-DD-YYYY HH:MM:SS04-05-2022 08:28:33








https://stackoverflow.com/a/32886576
https://stackoverflow.com/questions/27454025/unable-to-obtain-localdatetime-from-temporalaccessor-when-parsing-localdatetime/32886576#32886576 )



Unable to obtain LocalDateTime from TemporalAccessor when parsing LocalDateTime (Java 8)


If you really need to transform a date to a LocalDateTime object, you could use the LocalDate.atStartOfDay(). This will give you a LocalDateTime object at the specified date, having the hour, minute and second fields set to 0:

final DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMMdd");
LocalDateTime time = LocalDate.parse("20140218", formatter).atStartOfDay();






































No comments:

Google Referrals