创建: 2020/11/21

完成: 2020/11/21

java.util.*

Date
构造函数
Date() 生成现在时间
Date(long msec)  
Date(int year, int month, int date)  
Date(int year, int month, int date, int hrs, int min)  
Date(String s)  
   
实例函数
boolean after(Date d)  
boolean before(Date d)  
boolean equals(Date d)  
int compareTo(Date d)

self-d

=d: 0

>d: 1

<d: -1

long getTime() 毫秒
void setTime(long msec)  
String toString()  
   
   
Calendar
静态变量
ALL_STYLES  
AM  
AM_PM  
APRIL  
AUGUEST  
DATE  
DAY_OF_MONTH  
DAY_OF_WEEK  
DAY_OF_WEEK_IN_MONTH  
DAT_OF_YEAR  
DECEMBER  
DST_OFFSET  
ERA  
FEBRUARY  
FIELD_COUNT  
FRIDAY  
HOUR  
HOUR_OR_DAY  
JANUARY  
JULY  
JUNE  
LONG  
MARCH  
MAY  
MILLISECOND  
MINUTE  
MONDAY  
MONTH  
NOVEMBER  
OCTOBER  
PM  
SATURDAY  
SECOND  
SEPTEMBER  
SHORT  
SUNDAY  
THURSDAY  
TUESDAY  
UNDECIBER 太阳历的十三月
WEDNESDAY  
WEEK_OF_MONTH  
WEEK_OF_YEAR  
YEAR  
ZONE_OFFSET  
   
构造函数 没有public的, 用静态函数来生成
静态函数

 

static Calendar getInstance()

static Calendar getInstance(Locale l)

static Calendar getInstance(TimeZone t)

static Calendar getInstance(TimeZone t, Locale t)

 
   
   
   
   
   

 

实例函数
boolean after(Calendar obj)  
boolean before(Calendar obj)  
boolean equals(Calendar obj)  
int compareTo(Calendar obj )

self - obj

=obj: 0

>obj: 1

<obj: -1

int get(int calendarField)

获取指定要素

  •  calendarField 通过静态变量来指定, 如 Calendar.YEAR 

String getDisplayName(int calendarField, int style, Locale l)

throws IllegalArgumentException, NullPointerException

  • sytle:   Calendar.SHORT 或 Calender.LONG 
final Date getTime()  
long getTimeInMillis()   
TimeZone getTimeZone()   
final void set(int year, int month, int, date, int hrs, int minute, int second)   
final void setTime(Date d)  
final void setTimeInMillis(long l)  
   
   
   
TimeZone  
简介  通常只用静态方法 
静态方法
static String[] getAvailableIDs()  
static TimeZone getDefault()  
static TimeZone getTimeZone(String s)
  • Asia/Tokyo, GMT+9:00这样
  • 或者getAvailableIDs的返回值里选
static void setDefault(TimeZone t) 设定getDefault返回的时区
   
   
   
Locale
构造函数
Locale(String l)  
Locale(String l, String c)  
Locale(String l, String c, String v)
  • l: 语言代码
  • c: 国家和地区码
  • v:  variant TODO: ???
静态函数

 

static Locale[] getAvailableLocales()  
static Locale getDefault()  
static void setDefault(Locale l)  
   
   
   
实例函数

 

String getCountry()  
String getLanguage()  
String getVariant()  

String getDisplayCountry()

String getDisplayCountry(Locale l)

 

String getDisplayLanguage()

String getDisplayLanguage(Locale l)

 

String getDisplayName()

String getDisplayName(Locale l)

 
String getDisplayVariant()
String getDisplayVariant(Locale l)
 
   
   
   
   
   
GregorianCalendar
  TODO: fix