System.currentTimeMillis() does not return correct time of day.

Hello, I was helping my nephew make an analog clock and I initially tried to use currentTimeMillis() but it just won’t return the correct hour( minutes and seconds are fine though). So I tried to use Date() only for eclipse to tell me it’s deprecated(works flawlessly though). Then after a few searches, I settled for Calendar.

Any one knows how to use currentTimeMillis() to get the time of day?

Code demo here:

http://pastebin.java-gaming.org/9e707381172

Thanks!

Use Calendar to take timezones (and summertime) into account.

currentTimeMillis() returns the total amount of milliseconds between present and January 1 1970, so to find the day/hour/etc calendar is a lot easier to use.

Thanks guys. I decided on calendar. :slight_smile: