• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

convert String to Date

 
Peter Guillebaud
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how to do this for multiple dates if the date Strings are of variable lengths? I think the SimpleDateFormat class should help but how can it be done when one date String is August 31, 2001 14:00 GMT and another September 18, 2001 23:00 GMT ? The format is the same but the number of letters for each month changes!! I need to change it to format yyyy-mm-dd.
Thanks in advance.

 
Paul Stevens
Ranch Hand
Posts: 2823
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The length doesn't matter you tell it what format the String is in and the parse method takes care of the details.
 
Chad McGowan
Ranch Hand
Posts: 265
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use this SimpleDateFormat string
 
Peter Guillebaud
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks very much, that works perfectly.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic