• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1104
  • Last Modified:

time format affected by time switching?!

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.
0
TheSilverBullet
Asked:
TheSilverBullet
  • 4
  • 3
1 Solution
 
sciuriwareCommented:
Set the timezone to GMT or UTC, that's without daylight saving time.

;JOOP!
0
 
TheSilverBulletAuthor Commented:
I have set it to GMT but it returns one hour less!!!
0
 
sciuriwareCommented:
Less than what?

;JOOP!
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
TheSilverBulletAuthor 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
0
 
sciuriwareCommented:
Then set it to GMT+1 (C-EUROPE): you'll get what you set for.

;JOOP!
0
 
TheSilverBulletAuthor Commented:
I know, but what if the tool will be used in japan later on? this will give wrong results , wont it?
0
 
sciuriwareCommented:
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!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now