The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
April 2001

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

String to Date

Posted by Tomas Laurenzo on December 21, 2001 at 2:14 PM

Hi,

Both if you want to construct a Date object form String or you want to reformat a String pattern (string literal) you have to use the SimpleDateFormat class (java.text package).

e.g:
SimpleDateFormat dateParser = new SimpleDateFormat ("dd/MM/yyyy");
Date date = new Date(dateParser);

hope this helps,
tom.






Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us