The Constructor Date(String) is Deprecated since of JDK 1.1 you should not use it
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.
1
|
private
static
final
SimpleDateFormat sdf =
new
SimpleDateFormat(”yyyy-MM-dd”);
|
2
|
String birthDate = “
1981
-
12
-
30
?;
|
3
|
Date birth = sdf.format(birthDate);
|
如果您觉得不错,欢迎扫码支持下。
作者:许强1. 本博客中的文章均是个人在学习和项目开发中总结。其中难免存在不足之处 ,欢迎留言指正。 2. 本文版权归作者和博客园共有,转载时,请保留本文链接。