java 常用工具类
作者:互联网
1. 时间格式化
import org.apache.commons.lang3.time.FastDateFormat;
...
FastDateFormat df = FastDateFormat.getInstance("yyyy-mm-dd");
// 将指定格式字符串(上面的 yyyy-mm-dd,可根据需要自行配置)日期转为Date对象
Date dt = df.parse("2022-01-01");
// 将 Date 对象格式话输出为字符串
System.out.println(df.format(new Date(System.currentTimeMillis())));
标签:01,java,df,dd,FastDateFormat,yyyy,Date,常用工具 来源: https://www.cnblogs.com/brian-sun/p/16635615.html