Solved

time format affected by time switching?!

Posted on 2006-10-30
7
1,090 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
  • 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 

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

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet example issue 6 46
sql import cannot be resolved jsp 3 47
java imports not found 4 26
Java basic valueOf question 1 29
For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
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…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.

856 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