import java.util.Calendar;
public class GetDate {
public static void main(String[] args) {
Calendar ca1 = Calendar.getInstance();
/// get day month year from set date
ca1.set(2009, 05, 15); // dont set this date if current date is required
int iDay=ca1.get(Calendar.DATE);
int iMonth=ca1.get(Calendar.MONTH); // In Current date Add 1 in month
int iYear=ca1.get(Calendar.YEAR);
System.out.println("Day :"+iDay);
System.out.println("Month :"+iMonth);
System.out.println("Year :"+iYear);
}
}
0 comments:
Post a Comment