3:33 pm - Sunday June 25, 2017

Calendar in java example program get(int field)

CANDID INDUSTRIAL TRAINING -- CHENNAI
Corporate Training for Experienced Candidate
Struts | Hibernate | Spring | Java / J2EE
SOAP | RestFull | Design Pattern | more...
Ph: +91 72000 69003
137b, 2nd st, shanthi nagar, Chrompet, Chennai -600044
/**
 *@author: candidjava
 *@description: Collections in JAVA example program for get(int field)
 **/

import java.util.Calendar;

public class CalendarDemo {
	public static void main(String[] args) throws Exception {
		// create a calendar
		Calendar cal = Calendar.getInstance();
		// get the value of all the calendar date fields.
		System.out.println("Calendar's Year: " + cal.get(Calendar.YEAR));
		System.out.println("Calendar's Month: " + cal.get(Calendar.MONTH));
		System.out.println("Calendar's Day: " + cal.get(Calendar.DATE));
	}
}

Output

Calendar's Year: 2012
Calendar's Month:9
Calendar's Day:12

BACK

Filed in: Z-A All Java Codes

Comments are closed.