<%@ page import="java.util.*" %>
Fields of the Calendar Class
Fields of the Calendar Class
<%
String dateString = new String();
GregorianCalendar calendar = new GregorianCalendar();
Date date1 = new Date();
calendar.setTime(date1);
dateString += "Calendar.YEAR is " + calendar.get(Calendar.YEAR) + "
";
dateString += "Calendar.MONTH is " + calendar.get(Calendar.MONTH) + "
";
dateString += "Calendar.WEEK_OF_YEAR is " + calendar.get(Calendar.WEEK_OF_YEAR) +
"
";
dateString += "Calendar.WEEK_OF_MONTH is " + calendar.get(Calendar.WEEK_OF_MONTH)
+ "
";
dateString += "Calendar.DATE is " + calendar.get(Calendar.DATE) + "
";
dateString += "Calendar.DAY_OF_MONTH is " + calendar.get(Calendar.DAY_OF_MONTH) +
"
";
dateString += "Calendar.DAY_OF_YEAR is " + calendar.get(Calendar.DAY_OF_YEAR) +
"
";
dateString += "Calendar.DAY_OF_WEEK is " + calendar.get(Calendar.DAY_OF_WEEK) +
"
";
dateString += "Calendar.DAY_OF_WEEK_IN_MONTH is "
+ calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH) + "
";
dateString += "Calendar.AM_PM is " + calendar.get(Calendar.AM_PM) + "
";
dateString += "Calendar.HOUR is " + calendar.get(Calendar.HOUR) + "
";
dateString += "Calendar.HOUR_OF_DAY is " + calendar.get(Calendar.HOUR_OF_DAY) +
"
";
dateString += "Calendar.MINUTE is " + calendar.get(Calendar.MINUTE) + "
";
dateString += "Calendar.SECOND is " + calendar.get(Calendar.SECOND) + "
";
dateString += "Calendar.MILLISECOND is " + calendar.get(Calendar.MILLISECOND) +
"
";
dateString += "Resetting the date!
";
calendar.set(2005, 11, 31, 23, 59);
dateString += "Calendar.YEAR is " + calendar.get(Calendar.YEAR) + "
";
dateString += "Calendar.MONTH is " + calendar.get(Calendar.MONTH) + "
";
dateString += "Calendar.WEEK_OF_YEAR is " + calendar.get(Calendar.WEEK_OF_YEAR) +
"
";
dateString += "Calendar.WEEK_OF_MONTH is " + calendar.get(Calendar.WEEK_OF_MONTH)
+ "
";
dateString += "Calendar.DATE is " + calendar.get(Calendar.DATE) + "
";
dateString += "Calendar.DAY_OF_MONTH is " + calendar.get(Calendar.DAY_OF_MONTH) +
"
";
dateString += "Calendar.DAY_OF_YEAR is " + calendar.get(Calendar.DAY_OF_YEAR) +
"
";
dateString += "Calendar.DAY_OF_WEEK is " + calendar.get(Calendar.DAY_OF_WEEK) +
"
";
dateString += "Calendar.DAY_OF_WEEK_IN_MONTH is "
+ calendar.get(Calendar.DAY_OF_WEEK_IN_MONTH) + "
";
dateString += "Calendar.AM_PM is " + calendar.get(Calendar.AM_PM) + "
";
dateString += "Calendar.HOUR is " + calendar.get(Calendar.HOUR) + "
";
dateString += "Calendar.HOUR_OF_DAY is " + calendar.get(Calendar.HOUR_OF_DAY) +
"
";
dateString += "Calendar.MINUTE is " + calendar.get(Calendar.MINUTE) + "
";
dateString += "Calendar.SECOND is " + calendar.get(Calendar.SECOND) + "
";
dateString += "Calendar.MILLISECOND is " + calendar.get(Calendar.MILLISECOND) +
"
";
out.println(dateString);
%>