Java: Get current Date and Time from Server not System clock
Posted
by Insectatorious
on Stack Overflow
See other posts from Stack Overflow
or by Insectatorious
Published on 2010-05-12T09:27:47Z
Indexed on
2010/05/12
9:34 UTC
Read the original article
Hit count: 149
In my Java program, I need to create an instance of the current moment in time. I use
Date date = new Date();
This gives me the current date and time as per the host machine's system clock. Is there any way I can get the current date and time from an online server? The world time server perhaps?
I have seen this post and it describes what I want but I'm afraid I need more help than what's provided there.
In a nutshell, I want to get a date and time that is not dependant on the host machine's system clock.
Thanks!
© Stack Overflow or respective owner