Java Date 时间类的使用

Java Date 时间类的使用

java.util.Date:表示日期和时间的类,可以进行时间戳,日期转化和日期格式化的的操作
代码中的时间原点:1970年1月1日 00:00:00 时间戳计算的起点

获取当前的时间戳

public class Demo {
    public static void main(String[] args) {
        System.out.print(System.currentTimeMillis());// 获取当前时间戳(从时间原点起多少毫秒),返回值为long类型
    }
}

猜你喜欢

转载自www.cnblogs.com/Kingfan1993/p/12683923.html