WinseterCheng

旧的时间字符串-->simpledataformat1.parse(该字符串) 获得date类型 -->simpledataformat2.format(date)
simpledateformat1的pattern的格式和旧的字符串相同,simpledateformat2的pattern格式和希望的相同。
比如
旧的字符串格式为 yyyy-MM-dd,希望转换为yyyy年MM月dd日

String old="2019-12-13";
DateFormat format1 = new SimpleDateFormat("yyyy-MM-dd");
Date date=format1.parse(old);
DateFromat format2=new SimpleDateFormat(yyyyMMdd);
String new=format2.format(date);

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2021-09-19
  • 2022-12-23
  • 2021-04-12
  • 2021-12-26
  • 2021-12-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 1970-01-01
  • 2022-02-08
  • 2022-12-23
  • 2021-09-26
  • 2021-07-13
相关资源
相似解决方案