Results 1 to 4 of 4

Thread: Calendar program in java

  1. #1
    Join Date
    Nov 2009
    Posts
    140

    Calendar program in java

    Hello,

    I am creating a program in java, but the problem is that i am a fresher in development of java program. This is my office project on which i am working to update the record of the user for complete month, but i don't know how to do that and which object will define the same. I cant take any help in my office because it is about my reputation. So i finally posted my query here to get help regarding that. So help me if any one have the solution and its urgent.

    Thanks in advance.

  2. #2
    Join Date
    May 2008
    Posts
    4,834

    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!!!!!!!!!!!!

  3. #3
    Join Date
    Apr 2008
    Posts
    4,089

    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));
    }
    }

  4. #4
    Join Date
    Apr 2008
    Posts
    2,139

    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

Similar Threads

  1. Dr. Java program
    By bamggut29 in forum Software Development
    Replies: 2
    Last Post: 26-11-2011, 03:24 AM
  2. help me to understand java code (calendar java code) ?
    By so0oma in forum Software Development
    Replies: 2
    Last Post: 09-01-2011, 11:01 PM
  3. Help me program a calculator in java
    By Kelvin Little in forum Software Development
    Replies: 4
    Last Post: 28-06-2010, 05:55 PM
  4. Calendar API in java
    By Miles Runner in forum Software Development
    Replies: 5
    Last Post: 05-02-2010, 04:23 AM
  5. Link List Example in Java Sample program in Java
    By trickson in forum Software Development
    Replies: 2
    Last Post: 04-08-2009, 08:23 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •