• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • 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: 5127
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic