Please i am new in java and i need some help about how i can make appointment calendar as a java application by using java

thanks

You can find some code examples here (check the Date and Time section) also google search will get even more examples, here. Work throught them and if you get in some troubles, then post. However do not expect us to do your work...

Thank you , but i did not mean that and it is not work just i want to make prictis by using java

please i need you advise to this code regarding appointment Calendar
Date fields:
Year +Month +Day_of_Month
Year + Month +Week_of_Month + Day_of_Week
Year + Month + Day_of_Week_In_Month + Day_of_Week
Year + Day_of_Year
Year + Day_Of_Week + Week_of_Year

Time of day fields:
Hour_of_Day
AM_PM + Hour

// constructor: confirm proper value for month;
// call method chckDay to confirm proper
// value for day

Public Date (int mn, int dy, int yr)
{
If (mn>0 && mn<=12) // validate the month
Month = mn;
else {
month = 1;
system.out.print1n ("month" +mn+"invalid. set to month 1.");
}
year=yr; // could also check
day=checkDay (dy); // validate the day

I guess you trying to do command line program or you would not come up with this checks on GUI or JSP...

public class Date
{
    private int month;
    private int day;
    private int year;

    public Date(int m, int d, int y)
    {
        month = checkMonth(m);
        year = y;
        day = checkDay(d);
    }

    private int checkMonth(int m)
    {
        if( m > 0 && m<= 12)
        {
            return m;
        }
        else
        {
            System.out.printf("Invalid month (%d) set to 1.", m);
            return 1;           
        }
    }

    private int checkDay(int d)
    {
        int  daysPerMonth[] = 
        {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};

        if(d > 0 && d <= daysPerMonth[month])
        {
            return d;
        }
        if(month == 2 && d == 29 && 
            (year%400 == 0 || (year%4 == 0 && year %100 != 0)))
        {
            return d;
        }

        System.out.printf("Invalid day (%d) set to 1.", d);
        return 1;
    }
}

Have look into JAVA API for

  1. java.util.GregorianCalendar
  2. java.util.Calendar
  3. java.text.DateFormat

Try to avoid using java.util.Date that can be mentioned in some out of date tutorials

PS: When you paste code in your post please use following tags (code)YOUR CODE HERE(/code) or click on hash "#" sign in post toolbar that will get you this in your posting area automaticaly

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.