package Utils; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public final class DateStringExchange { public static String getNowDateString(){ return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); } public static Date getNowDate(){ Date date=new Date(); return date; } public static Date StringToDate(String time) throws ParseException { return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(time); } public static String DateToString(Date date) throws ParseException { return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date); } }
获取当前日期 and 日期与字符串转换
猜你喜欢
转载自blog.csdn.net/qq_43055343/article/details/109080700
今日推荐
周排行