This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to make a calender Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to make a calender" Watch "How to make a calender" New topic

How to make a calender

rk sharma
Ranch Hand

Joined: Jun 25, 2011
Posts: 63

How to make a calender in JAVA that can take a date format and then display the corresponding just like a normal calender date in graphical mode. the code shold not contain any predefined API. Please help me any one by just saying the algorithm. And the the design steps....


Madhan Sundararajan Devaki
Ranch Hand

Joined: Mar 18, 2011
Posts: 312

I don't think you can achieve what you want, without using pre-defined API (for example, Swing...) as JAVA is made of pre-defined APIs. ;)

Not many get the right opportunity !
Greg Brannon

Joined: Oct 24, 2010
Posts: 563
The OP probably means that existing APIs that provide calendar and date functions can't be used.

Here's a rough outline of what must be done:

Hopefully, there's a reasonable bound to the problem; beginning and end dates for which your program must work. I'll assume so.

1. Get a date from the user (month/year).
2. Check that the date is valid: between the upper and lower bounds, a real month/year, etc.
3. Determine the starting day for the user's month and year.
a. Based on knowledge of one day within the bounded dates
b. Determine the leap years between known date and user date
c. Calculate the starting day of the user's month.
4. Determine the number of days in the user's month
5. Using result of 3 and 4, print the user's month/year.
a. Typical format:
(skip the number of days before the correct start date, then print the dates.)
5. Continue until the user is done.

Always learning Java, currently using Eclipse on Fedora.
Linux user#: 501795
Jim Hoglund
Ranch Hand

Joined: Jan 09, 2008
Posts: 525
What do you want to do with the displayed date/calendar after it has been displayed?

Jim ... ...

I agree. Here's the link:
subject: How to make a calender
It's not a secret anymore!