We help IT Professionals succeed at work.

time format affected by time switching?!

Medium Priority
Last Modified: 2008-01-09
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.
Watch Question

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



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



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.


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

Ask the Experts


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.

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.


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.