Results 1 to 20 of 21
Thread: How to create a Calendar
- 09-15-2011, 03:05 PM #1
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
How to create a Calendar
Hi, I have implemented a program and a calendar is part of my app. To implement the calendar I have got it's source code from the Internet. I want if user clicks on one day of the calendar then another page will be shown to the user and in that page user will enter a specific number and then the user will click on a save button in it and after that when user selects that day in the calendar again it must show a page with just the specific number which the user enterd earlier!to implement this I want to create indexes for all the days of a year which are like a specific key for each day and I want to save the indexes in the database so when user clicks on a day with a specific key it shows it's specific number! Could anyone tell me how can I create indexes for all days of a year?
- 09-15-2011, 03:35 PM #2
Re: How to create a Calendar
What is the index you want? An integer? The day of the year?
- 09-15-2011, 05:07 PM #3
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
Re: How to create a Calendar
thanks for your reply, I want each day of a specific year has an Integer index. for example last day of the third month of a year has Index 92.
- 09-15-2011, 05:11 PM #4
Re: How to create a Calendar
Is that the day of the year? An integer from 1 to 365/366.
- 09-15-2011, 05:48 PM #5
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
Re: How to create a Calendar
thank you for your reply, Yes I mean this!
- 09-15-2011, 06:08 PM #6
Re: How to create a Calendar
The Calendar class will give you the day of year for a given date.
Have you read the API doc for that class?
- 09-15-2011, 06:31 PM #7
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
Re: How to create a Calendar
I knew it, but first I want to create indexes for all the days and the I want to use the index for selected day like I explained earlier!
- 09-15-2011, 06:34 PM #8
Re: How to create a Calendar
Sorry, I don't understand your problem.
The indexes are just the numbers 1-365. What is there to create?
Is the problem going from the nth day of the year to the month and day of month?
- 09-15-2011, 06:44 PM #9
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
Re: How to create a Calendar
I don't know how to extract the days of a year and then create indexes for them?! Is it clear for you
- 09-15-2011, 06:46 PM #10
Re: How to create a Calendar
Have you looked at the Calendar class? I has method for doing a lot date manipulations.
You can create the DD/MM for any day of the year with its methods.
- 09-15-2011, 07:07 PM #11
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
Re: How to create a Calendar
How can I create the DD/MM for any day of the year for the Calendar?what is its methods? In Java apI doc I found I can use
int get(int field)
Gets the value for a given time field.
and
DAY_OF_YEAR
Field number for get and set indicating the day number within the current year
but I don't know How can I use these two things to extract the days of a year and create indexes for the days!?
- 09-15-2011, 07:11 PM #12
Re: How to create a Calendar
Look at the large code sample in the API doc for using the methods to get and set dates.
If you set the day of the year starting at 1 get the date for that day, and continue through day 365 you will have the dates for the 365 days of the year.
- 09-15-2011, 07:21 PM #13
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
Re: How to create a Calendar
thanks, when I write this code in my prog calendar.get(calendar.DAY_OF_YEAR) the prog will have an error that is can not find symbol DAY_OF_YEAR. so what is your solution about it?
- 09-15-2011, 07:26 PM #14
Re: How to create a Calendar
Look at the API doc to get the correct spelling.
I copied the large example from there and had no problems compiling and executing it.
- 09-15-2011, 07:30 PM #15
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
Re: How to create a Calendar
I have copied the code from the API but it seems my netbeans has problem for this! I can use calendar.get(calendar.DAY_OF_MONTH) instead of YEAR but if so I can't have my favorit program!
- 09-15-2011, 07:46 PM #16
Re: How to create a Calendar
Did you check your spelling?
Try this copied from the API doc:
System.out.println("DAY_OF_YEAR: " + calendar.get(Calendar.DAY_OF_YEAR));
- 09-15-2011, 11:57 PM #17
Member
- Join Date
- Sep 2011
- Posts
- 42
- Rep Power
- 0
Re: How to create a Calendar
Just a thought... If you are using the Calendar class, I hear the the GregorianCalendar has better methods and is more internationally friendly. I have never used the 2 myself so I don't know the difference.
- 09-16-2011, 11:01 PM #18
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
Re: How to create a Calendar
Hi, I have a problem again, about the Calendar How can I differ between selected date and date of today? I want that if user selects a date in Calendar which is less than date of today, some thing being shown to the user!
- 09-16-2011, 11:04 PM #19
Member
- Join Date
- Apr 2011
- Posts
- 30
- Rep Power
- 0
Re: How to create a Calendar
How can I differ between last day of a month and first day of the next month?
- 09-16-2011, 11:04 PM #20
Similar Threads
-
Create new Calendar object???
By aliencc in forum New To JavaReplies: 4Last Post: 01-17-2011, 01:19 PM -
How to add a calendar????
By zifis in forum New To JavaReplies: 5Last Post: 04-07-2009, 04:04 PM -
Calendar bug?
By Stigvig in forum Advanced JavaReplies: 14Last Post: 02-08-2009, 09:56 AM -
Create Calendar with Java
By neoseeker191 in forum New To JavaReplies: 4Last Post: 10-17-2008, 05:41 AM -
Web calendar
By Daniel in forum Enterprise JavaBeans (EJB)Replies: 1Last Post: 06-27-2007, 05:36 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks