环境:jdk 1.8.0

new date(),不能转入参数。IDE显示方法过时。如图:


date(String s)过时替换的方法示例


查源码后 得到如下解释,replaced by <code>DateFormat.parse(String s)</code>. 

date(String s)过时替换的方法示例

大概意思:date(String s) 方法被替换为 DateFormat.parse(String s)

示例:

//time to String
String myString = DateFormat.getDateTimeInstance().format(date);
//String to time
Date myString1 = DateFormat.getDateTimeInstance().parse(time);

仅供参数。原创,转载注明出处。


相关文章:

  • 2021-12-05
  • 2021-11-05
  • 2021-08-09
  • 2022-12-23
  • 2021-12-09
  • 2022-01-11
  • 2021-11-03
  • 2021-12-27
猜你喜欢
  • 2021-08-09
  • 2021-11-01
  • 2022-12-23
  • 2022-02-09
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案