ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

具体时间

2022-06-16 09:32:22  阅读:56  来源: 互联网

标签:java get System util 时间 具体 Calendar gregorianCalendar


package ten;

import java.util.GregorianCalendar;

public class Calendar {
   public static void main(String[] args) {
       GregorianCalendar gregorianCalendar = new GregorianCalendar();
       gregorianCalendar.set(2022,6,15,20,30,07);
       System.out.println("Year\tMonth\tDate\tHour\tHour24\tMinute\tSecond");
       System.out.println(gregorianCalendar.get(java.util.Calendar.YEAR)+"\t"+
               gregorianCalendar.get(java.util.Calendar.MONTH)+"\t"+
               gregorianCalendar.get(java.util.Calendar.DATE)+"\t"+
               gregorianCalendar.get(java.util.Calendar.HOUR)+"\t"+
               gregorianCalendar.get(java.util.Calendar.HOUR_OF_DAY)+"\t"+
               gregorianCalendar.get(java.util.Calendar.MINUTE)+"\t"+
               gregorianCalendar.get(java.util.Calendar.SECOND));
       System.out.println("Days of week:"+gregorianCalendar.get(java.util.Calendar.DAY_OF_WEEK));
       System.out.println("Days of month:"+gregorianCalendar.get(java.util.Calendar.DAY_OF_MONTH));
       System.out.println("Days of year:"+gregorianCalendar.get(java.util.Calendar.DAY_OF_YEAR));
       System.out.println("week of month"+gregorianCalendar.get(java.util.Calendar.WEEK_OF_MONTH));
       System.out.println("week of year"+gregorianCalendar.get(java.util.Calendar.WEEK_OF_YEAR));
  }
}
 

标签:java,get,System,util,时间,具体,Calendar,gregorianCalendar
来源: https://www.cnblogs.com/wyx-5555/p/16380772.html

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有