Sunday, March 03, 2024

Goodbye Blogger

Farfetched blog is dead; long live Farfetched blog!

Thursday, February 01, 2024

Java date time literal

The simplest way to do a modern datetime literal in java is with Instant, e.g.:

    Instant.parse("2024-01-28T23:00:00Z")

And has useful methods for getting its low level equivalent:

    Instant.parse("2024-01-28T23:00:00Z").toEpochMilli()

And which can easily be converted to a LocalDateTime with:

    LocalDateTime.ofInstant(Instant.parse("2024-01-28T23:00:00Z"), ZoneId.systemDefault())