How to get today's date in java if system date is one year back of current date? -


my motive current date without caring of system date.

my suggestion, if really can't rely on system time use time server. apache commons has useful client this. there plenty of examples online:

https://commons.apache.org/proper/commons-net/apidocs/org/apache/commons/net/ntp/ntpudpclient.html

there numerous available timeservers.

don't tempted correct date in code, fragile , break if corrects server time.

the obvious, , easier, solution correct time on server though!


Comments

Popular posts from this blog

amazon web services - S3 Pre-signed POST validate file type? -

c# - Check Keyboard Input Winforms -