java 常用API 时间 练习
文章目录
package com.orcal.demc01;
import java.util.Date;
public class Xuexi {
public static void main(String[] args) {
// TODO Auto-generated method stub
//计算机时间原点:1970年1月1日午夜00:00:00
long sysdate=System.currentTimeMillis();
System.out.println(sysdate);
//空惨构造代表当前系统时间日期的对象
Date d=new Date();
System.out.println(d);
//毫秒值转date对象
Date d2=new Date(10000000l);
System.out.println(d2);
//获取日期对象的毫秒值(date对象转毫秒值)
System.out.println(d2.getTime());
}
}
评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册⭐️ Admin快速开发: https://show.cool-admin.com/
赞 0⭐️ 官方文档: https://cool-js.com
赞 0⭐️ chatgpt在线体验: https://cool-js.com/ai/chat-vip/index.html?r=helloworld
赞 0