• GregorianCalendar类的使用


    Calendar与GregorianCalendar是父子关系,Calendar是父类.

    Calendar日历类

    GregorianCalendar类用法 对日期的年月日等进行加减

    public class GregorianCalendarTest {
    	public static void main(String[] args) {
    		SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
    		GregorianCalendar cal = new GregorianCalendar();
    		Date date = new Date();
    		System.out.println(sdf.format(date));
    		cal.setTime(date);
    		cal.add(1, 1);
    		Date time = cal.getTime();
    		System.out.println(sdf.format(time));
    	}
    }
    
    2019-12-06
    2020-12-06
    
    public final static int YEAR = 1;
    public final static int MONTH = 2;
    public final static int WEEK_OF_YEAR = 3;
    public final static int WEEK_OF_MONTH = 4;
    public final static int DATE = 5;
    public final static int DAY_OF_MONTH = 5;
    public final static int DAY_OF_YEAR = 6;
    public final static int DAY_OF_WEEK = 7;
    public final static int DAY_OF_WEEK_IN_MONTH = 8;
    public final static int AM_PM = 9;
    public final static int HOUR = 10;
    public final static int HOUR_OF_DAY = 11;
    public final static int MINUTE = 12;
    public final static int SECOND = 13;
    public final static int MILLISECOND = 14;
    public final static int ZONE_OFFSET = 15;
    。。。。。
    Calendar
    
  • 相关阅读:
    实例讲解如何在Delphi中动态创建dxBarManager内容
    SqlServer中创建Oracle连接服务器
    Delphi中的四舍五入函数
    Delphi中的四舍五入函数
    垃圾回收内存管理
    列表生成式
    列表函数&方法
    python切片
    python函数def
    Python 控制流、列表生成式
  • 原文地址:https://www.cnblogs.com/sm1128/p/11994452.html
Copyright © 2020-2023  润新知