Re: Calendar program in java
Hi,
It not a big deal to maintain the user information of complete month on the java. All you have to do, make a calendar object which will keep the 12 month object . And another method is to use a abstract interface for month and create first month object for implementing the month interface. But make sure that each month will have the display() method to display the same. I hope understand the concept of the calendar object. Now use it to fully enjoy the function.
Thats it!!!!!!!!!!!!
Re: Calendar program in java
Hi,
Here are the simple code to develop a calender program in the java. use it to update the record of the user.
Code:
import java. swing.*;
import java.awt.event.*;
import java.util.Calendar;
class CalendarExample
{
public static void main(String args[])
{
String months[] =
{"Jan", "Feb", "Mar", "Apr",
"May", "Jun", "Jul", "Aug",
"Sep", "Oct", "Nov", "Dec"};
Calendar calendar = Calendar.getInstance();
System.out.println("Present Date: ");
System.out.println(Months[calendar.get(Calendar.MONTH)]);
System.out.println(" " + calendar.get(Calendar.DATE) + " ");
System.out.println(calendar.get(Calendar.YEAR));
System.out.println("Present Time: ");
System.out.println(calendar.get(Calendar.HOUR) + ":");
System.out.println(calendar.get(Calendar.MINUTE) + ":");
System.out.println(calendar.get(Calendar.SECOND));
calendar.set(Calendar.HOUR, 10);
calendar.set(Calendar.MINUTE, 29);
calendar.set(Calendar.SECOND, 22);
System.out.println("Edit time: ");
System.out.println(calendar.get(Calendar.HOUR) + ":");
System.out.println(calendar.get(Calendar.MINUTE) + ":");
System.out.println(calendar.get(Calendar.SECOND));
}
}
Re: Calendar program in java
Its a better way to use the simpler date class to develop the pure date calculations program which will be used when you want to solve the difficulty TimeZones and times. So better to use the classes which i am giving you to help with the calendar issue.
Code:
com.mindprod.common11.BigDate
java.text.DateFormat
java.text.SimpleDateFormat
java.util.Calendar
java.util.Date
java.util.GregorianCalendar
java.util.TimeZone