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

HW5.33

时间:2016-08-23 12:50:05      阅读:120      评论:0      收藏:0      [点我收藏+]

标签:

技术分享

 

 1 import java.util.Calendar;
 2 
 3 public class Solution
 4 {
 5     public static void main(String[] args)
 6     {
 7         long totalMillis = System.currentTimeMillis();
 8         long totalSeconds = totalMillis / 1000;
 9         long second = totalSeconds % 60;
10         long totalMinutes = totalSeconds / 60;
11         long minute = totalSeconds % 60;
12         long totalHours = totalMinutes / 60;
13         long hour = totalHours % 24;
14 
15         Calendar calendar = Calendar.getInstance();
16         int year = calendar.get(Calendar.YEAR);
17         int month = calendar.get(Calendar.MONTH);
18         int date = calendar.get(Calendar.DATE);
19 
20         System.out.println(year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second);
21     }
22 }

 

HW5.33

标签:

原文地址:http://www.cnblogs.com/wood-python/p/5798720.html

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