We help IT Professionals succeed at work.

time format affected by time switching?!

TheSilverBullet
on
Medium Priority
1,113 Views
Last Modified: 2008-01-09
Hi,
I have this date format

simpleTimeFormat = new SimpleDateFormat("HH:mm:ss");
simpleTimeFormat.format( new Date(file.lastModified()) ).toString()

I get oddly the time increased automatically with 1 hour for a file before swithcing to new timing (before 29.10.06) !! how to prevent it from returning the time increased, ie to return exactly the time the file holds regardless of the winter or summer switching.
Comment
Watch Question

Set the timezone to GMT or UTC, that's without daylight saving time.

;JOOP!

Author

Commented:
I have set it to GMT but it returns one hour less!!!
Less than what?

;JOOP!

Author

Commented:
than before, the file modification time is 9:30 , before it was increased 1 hour more automatically, ie in the debugger it reads 10:30 , which is not correct , if I set the simple date format default zone to GMt I get 8:30
Then set it to GMT+1 (C-EUROPE): you'll get what you set for.

;JOOP!

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I know, but what if the tool will be used in japan later on? this will give wrong results , wont it?
That's a Microsoft problem solved by Bell Labs in 1969,
so UNIX (and derivates) and LINUX don't know this problem.
In Windows you're bound to always account for the timezone.

;JOOP!
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.