首页 > 学院 > 开发设计 > 正文

System.currentTimeMillis()函数

2019-11-06 07:34:39
字体:
来源:转载
供稿:网友
package list;/* * 显示当前时间, * System中的currentTimeMillis()是返回从Unix操作系统发布的时间开始到现在当前时间 */public class List2_7 { public static void main(String[] args) { long totalMillissecends = System.currentTimeMillis();// 总毫秒数 long totalSecond = totalMillissecends/1000; //总秒数 long currentSecond = totalSecond%60; //当前秒速 long totalminuters = totalSecond/60; //总分钟数 long currentminuters = totalminuters%60; long totalHaurs = totalminuters/60; long crrentHaurs = totalminuters%24; System.out.PRintln(totalMillissecends + " " + totalSecond + " " + currentSecond + " " + totalminuters + " " + currentminuters + " " + totalHaurs + " " +crrentHaurs); System.out.println("crrent time is: " + crrentHaurs + " : " + currentminuters + " : " + currentSecond); }}
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表