• Post Reply Bookmark Topic Watch Topic
  • New Topic

Convert a date  RSS feed

 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a date in format A Fri Aug 26 12:05:10 BST 2005.

I want to covert it into format B 2005-10-26T12:05:10.12.

Is there a website I can look at that will explain how to do this in a steb by step process.

Thanks Tony
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16060
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Lookup the class java.text.SimpleDateFormat in the API documentation.

You first need to parse the input string with a SimpleDateFormat object with a format string that specifies how your input string looks. Then you need to format the resulting Date object with another SimpleDateFormat object with a format string that specifies how the output string should look.

Parsing a Date Using a Custom Format
Formatting a Date Using a Custom Format
 
Tony Evans
Ranch Hand
Posts: 598
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks that helped.

Tony
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!