How to convert UTC Date Time String to Java object and compare it ?

Use java.time.Instant;

import java.time.Instant;

Instant instantStart = Instant.parse("20200229T12:00:00Z");
Instant instantEnd = Instant.parse("20200329T12:00:00Z");
Instant instantNow = Instant.now();

return instantNow.isAfter(instantStart) &&  
       instantNow.isBefore(instantEnd);

Comments

Popular posts from this blog

How to fix error : no module named sendgrid when try to use sendgrid python lib in PHP.

react-native run-android : sun.security.provider.cert path.SunCertPathBuilderException : unable to find valid certification path to req uested target

react-native run-android : do not build/update modified code(App.js)