java 时间格式化

来源:互联网 发布:休眠状态关闭网络 编辑:程序博客网 时间:2024/06/01 22:27

java 时间格式化

Date dt = new Date();// 如果不需要格式,可直接用dt,dt就是当前系统时间DateFormat df = new SimpleDateFormat("yyyy-MM-dd");// 设置显示格式String dfDate = df.format(dt);//格式化之后的时间