• Post Reply Bookmark Topic Watch Topic
  • New Topic

parsing dates. oi.  RSS feed

 
stephen r davidson
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


The sysout...

lastModifiedDateStr from case is : 2013-06-29T02:40:24.000+0000
lastModifiedDate.toString() is :Fri Jun 28 20:40:24 MDT 2013

I expected to see milliseconds in my lastModifiedDate.toString() output. How can I get milliseconds in my output string?

Thanks...
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66305
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Date.toString() gives you what you got. You want another format, you use the result of the formatter with the format you want.

I don't really understand what you hoped to gain by converting the string back to a date instance.
 
stephen r davidson
Ranch Hand
Posts: 58
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Thanks for the hint...
}
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16059
88
Android IntelliJ IDE Java Scala Spring
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at one of our FAQ pages: https://www.coderanch.com/how-to/java/JavaDatesFaq

I recently added a part "Understanding Date objects, formatting and parsing" which will be useful.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!