• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

SimpleDateFormat seems to be adding an hour

 
Greenhorn
Posts: 21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm sure this must be something daft on my part.

When the expected output is 00:03:16.492, I'm getting 01:03:16.492
When the expected output is 01:19:56.492, I'm getting 02:19:56.492
If I try setting the time to 0 I get 01:00:00.000

Here is the code;
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Check into setting the timezone on your date or formatter. You may have a default that's adjusting for daylight savings time or something. Follow the JavaDoc trail ... somewhere in there it will tell you how to have none or how to make a generic timezone that doesn't convert anything. I'm not giving you concrete answers a) it's more fun for you to find them yourself and b) I've forgotten since the last time this bit me. Show us what you figure out!
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic