473,320 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Given a person's birthdate or any other date, will display day of week

i'm making a program that, given a person's birthdate or any other date, will display the day of the week of the person was born.
There is this part where it says "use a switch statement to make this calculation, If desired month is 12, add the number of days for November, if desired month is 11 add the number of days for october....

So it's suppose to start with "case 12 :...

I can't figure out what to write for the statement....
Oct 11 '12 #1
6 2120
johny10151981
1,059 1GB
if November is 12 what would be 1?
Oct 11 '12 #2
WRoos
7
If your developping under Windows, there's a global variable something like "longdateformat" if it has a value with 1d it showns the day without leading zero, 2d's with leading zero and 3d's as a full name. (I'm doing this by memory so it might not be completely right, but close enough)
If your OS can not do this, you best calculate a juliandatenumber. This can give the number of days past since year 0.
Oct 11 '12 #3
zmbd
5,501 Expert Mod 4TB
You need to post the code you've developed so far so that the experts here can get a sense of which direction you've taken.
Please rememeber to format any posted code using the <CODE/> format button.
Oct 11 '12 #4
weaknessforcats
9,208 Expert Mod 8TB
Also, set a starting date that marks the earliest date you will parse. Unix uses 1/1/1970.

You can't do year 0 because there was no calendar then.
Oct 11 '12 #5
WRoos
7
JulDate=[1461* (year+4716)/4] + [153* (month+1)/5]+Day+2-[year/100]+[year/400]-1524,5

use for january 13, for february 14 and subtract 1 from year
[...] means must be truncated in an integer.

Your right year 0 does not exist, but every year not using the Greorian calander (leapyears) are hypotatical. I've read ones the last european country to use the Grogorian calander is Turkey in 1927.
Oct 11 '12 #6
donbock
2,426 Expert 2GB
You should explicitly state in your solution that you assume the Gregorian calendar has always been in use. Ths assumption is not true, but modifying your algorithm to take into account shifts from one calendar to another can be a significant undertaking.
Oct 17 '12 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: rong.guo | last post by:
Hi Group! I am struggling with a problem of giving a date range given the start date. Here is my example, I would need to get all the accounts opened between each month end and the first 5...
1
by: Fabrizio | last post by:
HI I would like to know if there is any method to find the beginning date of a week starting from a week number For the week number 13 i would like to know which date (short) is on his first day.
1
by: Matt | last post by:
My ASPX page has a calendar, and when the user click any date on the calendar, it will display the report during that week. My question is when the program query database, I need to know the...
3
by: Marauderz | last post by:
Hello guys, got a little question regarding the regional language settings . Anyway I got a Windows 2003 Server machine that was installed with the date format "dd/MM/yyyy" and location still...
0
by: Juan T. Llibre | last post by:
VS.NET 2005/ASP.NET 2.0/SQL Server 2005/BizTalk Server 2006 will launch week of Nov. 7 ! http://www.microsoft.com/presspass/press/2005/jun05/TechEd2005Day2PR.mspx Juan T. Llibre ASP.NET...
2
by: Jack | last post by:
To whom may concern: In Asp.Net Calender control, how to display week days, like Wednesday as "Wed", Monday as "Mon", even my windows' region is set to Chinese? Thanks in advance! Jack...
2
by: Eng Teng | last post by:
Where is the part to set when my mouse pointer move to textbox or label or buton it will display text description ? Regards, Tee
2
by: sumanta123 | last post by:
Dear Sir, In my develpment i am getting stuck for a senario.Kindly please help me for it. Everytime we give the request we get the response of 8 records and its corresponding value. Then next...
1
by: mlibot | last post by:
hello... how to get the current path of the directory and it will display on the textfield... this is my codes: private void BrowseDirActionPerformed(java.awt.event.ActionEvent evt) { ...
2
by: SANDEEP PREMCHANDANI | last post by:
How do we add 15 days to the current Date which will not cross the month and resultant Date will never be Sunday? If it is Sunday make it Saturday? Example > If Current Date is 17/08/2010...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.