码迷,mamicode.com
首页 > 其他好文 > 详细

Date类

时间:2019-12-27 21:46:50      阅读:74      评论:0      收藏:0      [点我收藏+]

标签:throws   simple   gettime   demo   system   ring   code   orm   oid   

package cm.szz.demo01.demon09date;

import java.text.*;
import java.util.Date;

public class Demon09Date {
    public static void main(String[] args) throws ParseException {
        Date time = new Date();
        Date t = new Date(0L);
        System.out.println(time);//空参构造获取当时时间Fri Dec 27 20:03:32 CST 2019
        System.out.println(t);//把毫秒值转化Thu Jan 01 08:00:00 CST 1970
        long time1 = time.getTime();//获取当前时间的毫秒值
        System.out.println(time1);
        demon();
    }
    public static void demon() throws ParseException {
        SimpleDateFormat sdm = new SimpleDateFormat("yyyy年MM月dd日 HH时mm分ss秒");
        String format = sdm.format(26266666);
        Date date = sdm.parse("1970年01月01日 15时17分46秒");
        System.out.println(format);
        System.out.println(date);

    }
}

Date类

标签:throws   simple   gettime   demo   system   ring   code   orm   oid   

原文地址:https://www.cnblogs.com/xzwx668/p/12109561.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!