wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes Date conversions Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Date conversions" Watch "Date conversions" New topic
Author

Date conversions

Barb Rudnick
Greenhorn

Joined: Feb 03, 2005
Posts: 20
Hiya! First question for y'all.


When I run this I get the following output:
The date was: 2003-08-30 16:00:00
The date is: Sat Aug 30 11:00:00 CDT 2003
The long date is: 1062259200000

Why does 16:00:00 become 11:00:00?

Thanks.
Regards.
Stan James
(instanceof Sidekick)
Ranch Hand

Joined: Jan 29, 2003
Posts: 8791
I see you're trying to compensate for the time zone. What happens if you take out the adjustment: "sdf.getTimeZone().getOffset(temp.getTime()"? We had a production app that hummed along happily until daylight savings time came in, and I think we made a date format with no timezone info or a "dumb" default timezone that never adjusted. It was deeply confusing at the time.


A good question is never answered. It is not a bolt to be tightened into place but a seed to be planted and to bear more seed toward the hope of greening the landscape of the idea. John Ciardi
Barb Rudnick
Greenhorn

Joined: Feb 03, 2005
Posts: 20
When I adjust the code as suggested, it works as expected.
Thanks.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Date conversions
 
Similar Threads
SimpleDateFormat not returning expectec output?
set JVM timezone in Linux
How to obtain week of year for any given date
Date parsing error..???
Convert Local time to UTC and vice versa