This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Java in General and the fly likes Setting the System date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Setting the System date" Watch "Setting the System date" New topic

Setting the System date

Rakesh Rajagopalan
Ranch Hand

Joined: Sep 19, 2006
Posts: 59
How can i get and set system date? I need to synchronize my system's date/time with that of a server for every 30 minutes. Can you give me this coding?
Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Get is easy:

Setting it however is not. My guess is you would need to call a native method in the OS to do this (since it is the OS that tells the JVM the current time).

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
I agree. Here's the link:
subject: Setting the System date
Similar Threads
compare two dates thru Calendar
How to get tomorrow's date?
Problem inserting a null date into a MDB
Regarding the date obtained using java.util.Date class
Date Question