Date CurDate=new Date(System.currentTimeMillis());
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm");
String time=format.format(CurDate);
SimpleDateFormat format=new SimpleDateFormat("yyyy-MM-dd HH:mm");
String time=format.format(CurDate);
本文介绍如何使用Java获取当前系统时间并将其格式化为特定的字符串格式,例如“yyyy-MM-dd HH:mm”。通过实例展示了如何利用`new Date(System.currentTimeMillis())`获取当前时间,并使用`SimpleDateFormat`进行格式化。

被折叠的 条评论
为什么被折叠?



