wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes convert String to Date Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "convert String to Date" Watch "convert String to Date" New topic
Author

convert String to Date

Peter Guillebaud
Ranch Hand

Joined: Jul 11, 2001
Posts: 57
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

Joined: May 17, 2001
Posts: 2823
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

Joined: May 10, 2001
Posts: 265
use this SimpleDateFormat string
Peter Guillebaud
Ranch Hand

Joined: Jul 11, 2001
Posts: 57
Thanks very much, that works perfectly.
 
 
subject: convert String to Date
 
Similar Threads
Date(long date)
Java Date formatting problem
millenium bug returns!
Convert String value to Date Object
How do i format a string to date