赞
踩
- import java.text.SimpleDateFormat;
- import java.util.Date;
-
- public class Demo1 {
- public static void main(String[] args) {
- Long timeStamp = System.currentTimeMillis(); //获取当前时间戳
- SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
- String sd = sdf.format(Long.parseLong(String.valueOf(timeStamp)));
- String sd2 = sdf.format(new Date(Long.parseLong(String.valueOf(timeStamp))));
- String sd3 = sdf.format(timeStamp);
- System.out.println("格式化结果:" + sd);
- System.out.println("格式化结果:" + sd2);
- System.out.println("格式化结果:" + sd3);
- }
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。