Win a copy of Modern JavaScript for the Impatient this week in the Server-Side JavaScript and NodeJS forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Date conversions

 
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Barb Rudnick
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When I adjust the code as suggested, it works as expected.
Thanks.
 
I think she's lovely. It's this tiny ad that called her crazy:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic