bingtubao

导航

java内部时间转化代码

package t;

import java.text.SimpleDateFormat;
import java.util.Date;


public class c {

public static void main(String[] args) {
SimpleDateFormat simpleDateFormat = null;
simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
long time = 1612164195000l;
Date date = new Date(time);

String day = simpleDateFormat.format(date);
simpleDateFormat = new SimpleDateFormat("HH:mm:ss");
String time2 = simpleDateFormat.format(date);
System.out.println(day+" "+time2);
// System.out.println(System.currentTimeMillis());
//1611723733000

}

}

注意:

long time = 1612164195000l;中将最后一位前的时间编码替换,点击运行就可解码时间

 

posted on 2021-02-02 15:22  悠欢  阅读(98)  评论(0编辑  收藏  举报