Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-05-2008, 05:54 AM
Member
 
Join Date: Nov 2007
Posts: 12
veena is on a distinguished road
calendar of 12months when year is entered
hi everyone,

i need to take year and month as input and generate a calendar for 12months,
i need to rite a jsp page with servlet

can any 1 helpplz

Last edited by veena : 05-05-2008 at 03:38 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 05-05-2008, 06:03 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,967
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Did you Goole it. There should be some mathematical way to find it.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #3 (permalink)  
Old 05-05-2008, 06:08 AM
Member
 
Join Date: Nov 2007
Posts: 12
veena is on a distinguished road
yes i did and cudnt find anything
Bookmark Post in Technorati
Reply With Quote
  #4 (permalink)  
Old 05-05-2008, 06:23 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,967
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Ok, here is a way.

Code:
N = d + 2m + [3(m+1)/5] + y + [y/4] - [y/100] + [y/400] + 2
d - days of a monthe
m - moth id(from 1 to 12 respectively)
y - year

Do the calculations and find the N. Keep in mind that to drop the remainder in each [] and only get the whole number. Don't rounding off numbers. Then divide the N by 7. Remainder give the answer, day of the week.

0 - Saturday
1 - Sunday
2 - Monday
3 - Tuesday and so on.

Try it and see.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #5 (permalink)  
Old 05-05-2008, 06:41 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,967
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Ah, made a mistake in my explanation. Here is an example for today(5/5/2008)

Code:
N = 5 + 2(5) + [3(6)/5] + 2008 + [2008/4] - [2008/100] + [2008/400] + 2 N = 5 + 10 + 3 + 2008 + 502 - 20 + 5 + 2 N = 2515
After dividing by 7, remainder is 2, means that today is Monday. Yep, it's correct.

d is not the number of days of the month. Days spending up to date which we want to processing.

Did you get it?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #6 (permalink)  
Old 05-05-2008, 07:11 AM
Member
 
Join Date: Nov 2007
Posts: 12
veena is on a distinguished road
im trying to write in servlet and get in jsp

Last edited by veena : 05-05-2008 at 03:40 PM.
Bookmark Post in Technorati
Reply With Quote
  #7 (permalink)  
Old 05-05-2008, 07:13 AM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 386
Zosden is on a distinguished road
The way Eranga explain it is correct. except you have to account for leap years. which you do with an array I forget the exact table.
__________________
My IP address is 127.0.0.1
Bookmark Post in Technorati
Reply With Quote
  #8 (permalink)  
Old 05-05-2008, 07:19 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,967
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Quote:
Originally Posted by veena View Post
i tried for 1/1/2008
but im getting N=1 which is monday where i shud get tuesday as first day
You made a mistake there again.

Code:
N = 1 + 2(1) + [3(2)/5] + 2008 + [2008/4] - [2008/100] + [2008/400] + 2 N = 1 + 2 + 1 + 2008 + 502 - 20 + 5 + 2 N = 2502
Divide N by 7, remainder is 3. Means it's Tuesday. Check it again.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #9 (permalink)  
Old 05-05-2008, 07:24 AM
Member
 
Join Date: Nov 2007
Posts: 12
veena is on a distinguished road
hey Eranga

when u add up N=2501
Bookmark Post in Technorati
Reply With Quote
  #10 (permalink)  
Old 05-05-2008, 07:33 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,967
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Is it.

Code:
N = 1 + 2(1) + [3(2)/5] + 2008 + [2008/4] - [2008/100] + [2008/400] + 2 N = 1 + 2 + 1 + 2008 + 502 - 20 + 5 + 2 N = 5 + 2008 + 502 - 20 + 7 N = 2510 - 20 + 12 N = 2502
Where I'm going wrong pal. Can you pointed it for me?
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #11 (permalink)  
Old 05-05-2008, 07:42 AM
Member
 
Join Date: Nov 2007
Posts: 12
veena is on a distinguished road
let me try again

Last edited by veena : 05-05-2008 at 03:41 PM.
Bookmark Post in Technorati
Reply With Quote
  #12 (permalink)  
Old 05-05-2008, 07:59 AM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 386
Zosden is on a distinguished road
Linky
Try this on for size.
__________________
My IP address is 127.0.0.1
Bookmark Post in Technorati
Reply With Quote
  #13 (permalink)  
Old 05-05-2008, 08:00 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,967
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Go it. I've miss a very important rule there. Really sorry about. Still I remembering this and let you know, because I do those things few years back when I'm in the university for maths.

You have to use numbers 13 and 14 for the months of January and February, with the previous year. In our discussion,

1/1/2008 should be 1/13/2007.

Lets try it.

Code:
N = 1 + 2(13) + [3(14)/5] + 2007 + [2007/4] - [2007/100] + [2007/400] + 2 N = 1 + 26 + 8 + 2007 + 501 - 20 + 5 + 2 N = 2530
You get the correct answer there.

Lets do another example, for 20/2/2008. So the date should be 20/14/2007

Code:
N = 20 + 2(14) + [3(15)/5] + 2007 + [2007/4] - [2007/100] + [2007/400] + 2 N = 20 + 28 + 9 + 2007 + 501 - 20 + 5 + 2 N = 2552
Yep, I'm correct. Give the correct answer here too.

Keep in mind that, rule only valid for January and February.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #14 (permalink)  
Old 05-05-2008, 08:15 AM
Member
 
Join Date: Nov 2007
Posts: 12
veena is on a distinguished road
yep i got it and did in servlet
when i was searching i got the same formula

any ways thnks very much
its a nice formula though

Last edited by veena : 05-05-2008 at 03:41 PM.
Bookmark Post in Technorati
Reply With Quote
  #15 (permalink)  
Old 05-05-2008, 08:15 AM
Zosden's Avatar
Senior Member
 
Join Date: Apr 2008
Posts: 386
Zosden is on a distinguished road
I think you can just use the Gregorian calendar I think also.
__________________
My IP address is 127.0.0.1
Bookmark Post in Technorati
Reply With Quote
  #16 (permalink)  
Old 05-05-2008, 09:48 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,967
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
No matter what calender you used, my formula is working. We have used in few projects that formula, when I'm in the University.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
  #17 (permalink)  
Old 05-06-2008, 06:03 AM
Eranga's Avatar
Moderator
 
Join Date: Jul 2007
Location: Colombo, Sri Lanka
Posts: 2,967
Eranga has a spectacular aura aboutEranga has a spectacular aura about
Send a message via Yahoo to Eranga
Hey veena, no need to edit your post time to time. If you expecting the answer in different approaches please let it to others. Because later someone read your thread, really confused.
__________________
Use an appropriate Subject. "Help, urgent!" isn't one.
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

Has someone helped you? Then you can
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
their helpful post.

Want to make your IDE the best?
To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
(Close on September 4, 2008)

To view links or images in signatures your post count must be 10 or greater. You currently have 0 posts.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
calendar John SWT / JFace 12 08-07-2008 11:54 PM
[SOLVED] How to check what type of value entered in text field Renegade85 New To Java 2 04-28-2008 11:26 AM
Month and year program code!!!!HELP PLEASE!!! chitwood New To Java 0 02-10-2008 09:23 PM
Merry Christmas and happy New year rgbosque Forum Lobby 3 12-31-2007 03:44 AM
Web calendar Daniel Enterprise JavaBeans 1 06-27-2007 06:36 PM


All times are GMT +3. The time now is 04:52 PM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org