Hello KL,
Look into using the java.text.SimpleDateFormat class and its parse() method:
import java.text.*;
import java.util.*;
public class StringToDate {
public static void main(String args[]) {
String dateString = "30/01/2001";
try {
SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy");
Date newDate = df.parse(dateString);
System.out.println("New Date: " + newDate);
} catch (Exception e) {
e.printStackTrace();
}
}
}
-----Original Message-----
From: KL OOI [mailto:[EMAIL PROTECTED]]
Sent: Monday, September 10, 2001 9:14 PM
To: [EMAIL PROTECTED]
Subject: off-topic : Java Date
Hi all,
I have an existing date in String format, "30/01/2001", how do I format it
to Date object ??
Thanks.
KL
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
The information in this electronic mail ("e-mail") message may
be confidential and for use of only the named recipient. The
information may be protected by privilege, work product immunity
or other applicable law. If you are not the intended recipient
the retention, dissemination, distribution or copying of this
e-mail message is strictly prohibited. If you receive this e-mail
message in error please notify us immediately by telephone
at 770-723-1011 or [EMAIL PROTECTED] Thank you.
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html