Calendar.AM_PM : Calendar « java.util « Java by API






Calendar.AM_PM

   

/*
ERA: 1
YEAR: 2006
MONTH: 4
WEEK_OF_YEAR: 19
WEEK_OF_MONTH: 2
DATE: 11
DAY_OF_MONTH: 11
DAY_OF_WEEK: 5
DAY_OF_WEEK_IN_MONTH: 2
AM_PM: 1
MILLISECOND: 16
ZONE_OFFSET: -8
DST_OFFSET: 1 
 * */

import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;

public class MainClass {

  public static void main(String[] a) {
    Calendar calendar = new GregorianCalendar();
    calendar.setTime(new Date());

    System.out.println("ERA: " + calendar.get(Calendar.ERA));
    System.out.println("YEAR: " + calendar.get(Calendar.YEAR));
    System.out.println("MONTH: " + calendar.get(Calendar.MONTH));
    System.out.println("WEEK_OF_YEAR: " + calendar.get(Calendar.WEEK_OF_YEAR));
    System.out.println("WEEK_OF_MONTH: " + calendar.get(Calendar.WEEK_OF_MONTH));
    System.out.println("DATE: " + calendar.get(Calendar.DATE));
    System.out.println("DAY_OF_MONTH: " + calendar.get(Calendar.DAY_OF_MONTH));
    System.out.println("DAY_OF_WEEK: " + calendar.get(Calendar.DAY_OF_WEEK));
    System.out.println("DAY_OF_WEEK_IN_MONTH: " + calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH));
    System.out.println("AM_PM: " + calendar.get(Calendar.AM_PM));
    System.out.println("MILLISECOND: " + calendar.get(Calendar.MILLISECOND));
    System.out.println("ZONE_OFFSET: "+ (calendar.get(Calendar.ZONE_OFFSET)/(60*60*1000)));
    System.out.println("DST_OFFSET: "+ (calendar.get(Calendar.DST_OFFSET)/(60*60*1000)));
  }
}

           
         
    
    
  








Related examples in the same category

1.Calendar.DATE
2.Calendar.DAY_OF_WEEK_IN_MONTH
3.Calendar: DAY_OF_WEEK
4.Calendar.DAY_OF_YEAR
5.Calendar.DST_OFFSET
6.Calendar.ERA
7.Calendar.HOUR
8.Calendar.HOUR_OF_DAY
9.Calendar.MILLISECOND
10.Calendar.MINUTE
11.Calendar.MONDAY
12.Calendar: TUESDAY
13.Calendar.SECOND
14.Calendar.SUNDAY
15.Calendar.WEEK_OF_MONTH
16.Calendar.WEEK_OF_YEAR
17.Calendar.YEAR
18.Calendar.ZONE_OFFSET
19.Calendar: add(int field, int amount)
20.Calendar: after(Object when)
21.Calendar: before(Object when)
22.Calendar: int get(int field)
23.Calendar: getActualMaximum(int field)
24.Calendar: getDisplayNames(int field, int style, Locale locale)
25.Calendar: getFirstDayOfWeek()
26.Calendar: getInstance()
27.Calendar: getTime()
28.Calendar: set(int field, int value)
29.Calendar: set(int year, int month, int date)
30.Calendar: setTime(Date date)
31.Calendar: setTimeInMillis(long millis)