• 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
  • Ron McLeod
  • Tim Cooke
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Jeanne Boyarsky
Saloon Keepers:
  • Stephan van Hulst
  • Carey Brown
  • Tim Holloway
  • Piet Souris
Bartenders:

Help for using Java Time

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


The output is as the following:
Thu May 22 00:09:44 EDT 2008
2008-09-22 00:09:44 -0400

The format is correctly changed, but the time is wrong.

Please help...

Thanks,
Paul
[ August 08, 2008: Message edited by: Paul li ]
 
Rancher
Posts: 4936
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

the time is wrong.


What is the correct value?
Looks like the month is wrong. May is the 5th month.

You need to read the doc for the formatting letter usage. m vs M
[ August 09, 2008: Message edited by: Norm Radder ]
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Paul li:


The output is as the following:
Thu May 22 00:09:44 EDT 2008
2008-09-22 00:09:44 -0400

The format is correctly changed, but the time is wrong.
[ August 08, 2008: Message edited by: Paul li ]



It looks like the time is right, but the date is wrong. The pattern should be "yyyy-MM-dd HH:mm:ss Z". Capital M for Month, small m for minutes.
 
Paul li
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Norm, Steve,

Big help! Thanks a lot!

Paul
 
Oh, sure, you could do that. Or you could eat some pie. While reading this tiny ad:
The Low Tech Laboratory Movie Kickstarter is LIVE NOW!
https://www.kickstarter.com/projects/paulwheaton/low-tech
reply
    Bookmark Topic Watch Topic
  • New Topic