Request:
{"start date":"2025-01-15T00:00:01.000z"}
Java code to validate this date is past date or not.
Instant .parse( "2025-01-15T00:00:01.000Z" ) .isBefore( Instant.now() )
You have text in standard ISO 8601 format. The Z on the end indicates the text represents a moment as seen with an offset from UTC of zero hours-minutes-seconds.
Z
The Z should be uppercase. I assume your example has a typo with its lowercase z.
z
Instant
Parse as a java.time.Instant.
java.time.Instant
Instant startDate = Instant.parse( "2025-01-15T00:00:01.000Z" ) ;
Capture the current moment.
Instant now = Instant.now() ;
Compare.
boolean isPast = startDate.isBefore( now ) ;
Copyright © 2021 Jogjafile Inc.
tl;dr
ISO 8601
You have text in standard ISO 8601 format. The
Zon the end indicates the text represents a moment as seen with an offset from UTC of zero hours-minutes-seconds.The
Zshould be uppercase. I assume your example has a typo with its lowercasez.InstantParse as a
java.time.Instant.Capture the current moment.
Compare.