public static String getNowTime(){
Date date=new Date(System.currentTimeMillis());
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String nowTime=simpleDateFormat.format(date);
return nowTime;
}
public static String getNowDate(){
Date date=new Date(System.currentTimeMillis());
SimpleDateFormat simpleDateFormat=new SimpleDateFormat("yyyy-MM-dd");
String nowDate=simpleDateFormat.format(date);
return nowDate;
}
Java获取当前日期时间
最新推荐文章于 2023-11-14 14:44:57 发布