android之Date学习总结

android中的表示时间的类有:

java.lang.Object

    ↳java.util.Date 类Date指特定的瞬间,精确到毫秒。现在已很少使用。

java.lang.Object
  ↳java.util.Date
  ↳java.sql.Date
 类Date在sql中表示为yyyy-MM-dd格式。不能表示小时、分、秒。

java.lang.Object
↳java.util.Date
   ↳java.sql.Time
类Time在sql中表示hh:mm:ss格式。不能表示年、月、日。

java.lang.Object
  ↳java.util.Date
   ↳java.sql.Timestamp
 类Timestamp在sql中表示yyyy-MM-dd HH:mm:ss.nnnnnnnnn格式。

java.lang.Object
   ↳java.util.Calendar
抽象类Calendar提供Data和年、月、日、小时、分、秒等字段之间的转换。

ALL_STYLES Requests both SHORT and LONG styles in the map returned by getDisplayNames(int, int, Locale).
int AM Value of the AM_PM field indicating the period of the day from midnight to just before noon.
int AM_PM Field number for get and set indicating whether the HOUR is before or after noon.
int APRIL Value of the MONTH field indicating the fourth month of the year.
int AUGUST Value of the MONTH field indicating the eighth month of the year.
int DATE Field number for get and set indicating the day of the month.
int DAY_OF_MONTHField number for get and set indicating the day of the month.
int DAY_OF_WEEKField number for get and set indicating the day of the week.
int DAY_OF_WEEK_IN_MONTHField number for get and set indicating the ordinal number of the day of the week within the current month.
int DAY_OF_YEARField number for get and set indicating the day number within the current year.
int DECEMBER Value of the MONTH field indicating the twelfth month of the year.
int DST_OFFSETField number for get and set indicating the daylight savings offset from the ZONE_OFFSET in milliseconds.
int ERA Field number for get and set indicating the era, e.g., AD or BC in the Julian calendar.
int FEBRUARY Value of the MONTH field indicating the second month of the year.
int FIELD_COUNTThis is the total number of fields in this calendar.
int FRIDAY Value of the DAY_OF_WEEK field indicating Friday.
int HOUR Field number for get and set indicating the hour of the morning or afternoon.
int HOUR_OF_DAYField number for get and set indicating the hour of the day.
int JANUARY Value of the MONTH field indicating the first month of the year.
int JULY Value of the MONTH field indicating the seventh month of the year.
int JUNE Value of the MONTH field indicating the sixth month of the year.
int LONG Requests long names (such as "January") from getDisplayName(int, int, Locale) or getDisplayNames(int, int, Locale).
int MARCH Value of the MONTH field indicating the third month of the year.
int MAY Value of the MONTH field indicating the fifth month of the year.
int MILLISECONDField number for get and set indicating the millisecond within the second.
int MINUTE Field number for get and set indicating the minute within the hour.
int MONDAY Value of the DAY_OF_WEEK field indicating Monday.
int MONTH Field number for get and set indicating the month.
int NOVEMBER Value of the MONTH field indicating the eleventh month of the year.
int OCTOBER Value of the MONTH field indicating the tenth month of the year.
int PM Value of the AM_PM field indicating the period of the day from noon to just before midnight.
int SATURDAY Value of the DAY_OF_WEEK field indicating Saturday.
int SECOND Field number for get and set indicating the second within the minute.
int SEPTEMBER Value of the MONTH field indicating the ninth month of the year.
int SHORT Requests short names (such as "Jan") from getDisplayName(int, int, Locale) or getDisplayNames(int, int, Locale).
int SUNDAY Value of the DAY_OF_WEEK field indicating Sunday.
int THURSDAY Value of the DAY_OF_WEEK field indicating Thursday.
int TUESDAY Value of the DAY_OF_WEEK field indicating Tuesday.
int UNDECIMBERValue of the MONTH field indicating the thirteenth month of the year.
int WEDNESDAY Value of the DAY_OF_WEEK field indicating Wednesday.
int WEEK_OF_MONTHField number for get and set indicating the week number within the current month.
int WEEK_OF_YEARField number for get and set indicating the week number within the current year.
int YEAR Field number for get and set indicating the year.
int ZONE_OFFSETField number for get and set indicating the raw (non-DST) offset from GMT in milliseconds.

System.out.println("YEAR: " + calendar.get(Calendar.YEAR));

java.lang.Object
    ↳java.util.Calendar
   
 ↳java.util.GregorianCalendar 类GregorianCalendar提供了具体的实现。

java.lang.Object
    ↳java.text.Format
    ↳java.text.DateFormat
  抽象类DataFormat格式化或解析日期时间。

java.lang.Object
  ↳java.text.Format
  ↳java.text.DateFormat
    ↳java.text.SimpleDateFormat
 类 可以输出指定格式的日期时间


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值