• 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
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

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: 5014
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
 
I'm a lumberjack and I'm okay, I sleep all night and work all day. Lumberjack ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic