The Constructor Date(String) is Deprecated since of JDK 1.1 you should not use it

You should use java.text.SimpleDateFormat to convert String value to Date. E.g.

private static final SimpleDateFormat sdf = new SimpleDateFormat(”yyyy-MM-dd”);
String birthDate = “1981-12-30?;
Date birth = sdf.format(birthDate);

Related Post

String in Java?
Implement a stack?
What is singleton pattern? Write an example singleton class?

Comments

Leave a Reply




Technology