Return | Method | Summary |
---|---|---|
Date | parse(String source) | Parses text from the beginning of the given string to produce a date. |
Object | parseObject(String source, ParsePosition pos) | Parses text from a string to produce a Date. |
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
public class Main{
public static void main(String args[]) {
Date d = null;
try {
d = DateFormat.getDateInstance().parse("18-Nov-2010");
} catch (ParseException e) {
e.printStackTrace();
}
System.out.println(d);
}
}
The output:
Thu Nov 18 00:00:00 PST 2010
java2s.com | Contact Us | Privacy Policy |
Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
All other trademarks are property of their respective owners. |