Strange date issue

Put your problem here if it does not fit any of the other categories.

Strange date issue

Postby vallis » Wed Dec 02, 2009 6:24 pm

I've just come across a rather strange issue using java.util.Date on Android.

I'm declaring a a date object like so:
Date d = new Date(32400000);

The number value represents 9 hours in milliseconds.
Calling the following code should then output "09:00" to the debug logs.

DateFormat dateFormat = new SimpleDateFormat("HH:mm");
Log.d("debug", dateFormat.format(d));

On my home machine (Linux x64, eclipse galileo, android sdk r3, build for android 1.6) this code works fine.
On my university machine (Windows XP x86, eclipse galileo, android sdk r3, build for android 1.6) the output is one hour later - "10:00"

As this is only a uni project I'm not too bothered, more intrigued!
Can anyone offer any insight as to why this happens?

If I change the date declaration to Date d = new Date(28800000); the same thing happens, my home machine shows 08:00, uni shows 09:00!!
Very confusing.

I look forward to hearing from you.

V.
vallis
Junior Developer
Junior Developer
 
Posts: 23
Joined: Sat Oct 11, 2008 12:52 pm
Location: Scotland

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: Yahoo [Bot] and 12 guests