时间戳

    public static void main(String[] args) {

Long timestamp = System.currentTimeMillis();
timestamp += 1000 * 60 * 60 * 8;
long dayCounts =
(long) (Math.ceil((double) timestamp / (1000 * 60 * 60 * 24)));
System.out.println(timestamp);
System.out.println(dayCounts);
timestamp %= 1000 * 60 * 60 * 24;//天
System.out.println(timestamp);
Long hour = timestamp / (1000 * 60 * 60);//小时
timestamp %= 1000 * 60 * 60;
Long minute = timestamp / (1000 * 60);//分钟
timestamp %= 1000 * 60;//
Long secont = timestamp / 1000;
System.out.println(hour);
System.out.println(minute);
System.out.println(secont);
}
}
posted @ 2021-10-19 16:17  HelelLucifer  阅读(69)  评论(0)    收藏  举报