Solved

time format affected by time switching?!

Posted on 2006-10-30
7
1,094 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.
0
Comment
Question by:TheSilverBullet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
7 Comments
 
LVL 24

Expert Comment

by:sciuriware
ID: 17840279
Set the timezone to GMT or UTC, that's without daylight saving time.

;JOOP!
0
 

Author Comment

by:TheSilverBullet
ID: 17840414
I have set it to GMT but it returns one hour less!!!
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17840428
Less than what?

;JOOP!
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:TheSilverBullet
ID: 17840449
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
 
LVL 24

Accepted Solution

by:
sciuriware earned 50 total points
ID: 17840460
Then set it to GMT+1 (C-EUROPE): you'll get what you set for.

;JOOP!
0
 

Author Comment

by:TheSilverBullet
ID: 17840467
I know, but what if the tool will be used in japan later on? this will give wrong results , wont it?
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 17840477
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

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
The viewer will learn how to implement Singleton Design Pattern in Java.
Suggested Courses

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question