Java Calendar field meaning output

Source: Internet
Author: User

  @Test     public void testcalendar () {             calendar c=calendar.getinstance ();     c.set (2000, &NBSP;3,&NBSP;13,&NBSP;14,&NBSP;15,&NBSP;16);     c.set (calendar.millisecond, 123);// Random output &NBSP;&NBSP;&NBSP;&NBSP;SYSTEM.OUT.PRINTLN when not set (Formatutils.datetimestring (C.gettime ()));     system.out.println (C.get (calendar.year) + "<-Calendar.YEAR\n "     +c.get ( Calendar.month) + "<-Calendar.MONTH\n "     +c.get (calendar.week_of_year) + "<- calendar.week_of_year\n  "    +c.get (calendar.week_of_month) +" <-Calendar.WEEK_OF_ month\n  "    +c.get (calendar.day_of_week) +" <-Calendar.DAY_OF_WEEK\n  "      +c.get (Calendar.day_of_month) + "<-Calendar.DAY_OF_MONTH\n "      +c.get (calendar.day_of_Year) + "<-Calendar.DAY_OF_YEAR\n "         +c.get (Calendar.day_ Of_week_in_month) + "<-Calendar.DAY_OF_WEEK_IN_MONTH\n "     +c.get (calendar.hour_of_ Day) + "<-Calendar.HOUR_OF_DAY\n "     +c.get (calendar.hour) + "<-calendar.hour\n   "    +c.get (Calendar.minute) +" <-Calendar.MINUTE\n  "    + C.get (Calendar.second) + "<-calendar.second \n"     +c.get (Calendar.MILLISECOND) + " <-calendar.millisecond \n ");}

Input results

2000-04-13 14:15:16
2000<-calendar.year
3<-calendar.month
16<-calendar.week_of_year
3<-calendar.week_of_month
5<-calendar.day_of_week
13<-calendar.day_of_month
104<-calendar.day_of_year
2<-calendar.day_of_week_in_month
14<-calendar.hour_of_day
2<-calendar.hour
15<-calendar.minute
16<-calendar.second
123<-calendar.millisecond

Note: Calendar.day_of_week_in_month meaning: The month of 1-7 is the 1th week, 8-14 2 weeks ... In turn


Java Calendar field meaning output

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.