File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Soft Skills: The software developer's life manual this week in the Jobs Discussion forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help for using Java Time

 
Paul li
Greenhorn
Posts: 2
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Norm Radder
Ranch Hand
Posts: 707
3
  • 0
  • Mark post as helpful
  • send pies
  • 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 ]
 
Steve Luke
Bartender
Pie
Posts: 4181
21
IntelliJ IDE Java Python
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Norm, Steve,

Big help! Thanks a lot!

Paul
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic