HW5.33

HW5.33

 import java.util.Calendar;

 public class Solution
 {
     public static void main(String[] args)
     {
         long totalMillis = System.currentTimeMillis();
         long totalSeconds = totalMillis / 1000;
         long second = totalSeconds % 60;
         long totalMinutes = totalSeconds / 60;
         long minute = totalSeconds % 60;
         long totalHours = totalMinutes / 60;
         long hour = totalHours % 24;

         Calendar calendar = Calendar.getInstance();
         int year = calendar.get(Calendar.YEAR);
         int month = calendar.get(Calendar.MONTH);
         int date = calendar.get(Calendar.DATE);

         System.out.println(year + "-" + month + "-" + date + " " + hour + ":" + minute + ":" + second);
     }
 }
上一篇:vue前端项目优化策略


下一篇:(笔记)angular material radio用法