English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i am making this program where people have to put in a date and i want the computer to tell them what day of the week that is going to be.

for example the customer puts in 2/13/2020

2006-12-20 08:15:50 · 7 answers · asked by Honey006_sara 1 in Computers & Internet Programming & Design

7 answers

But, if you want to make your own software to find out the day of the week, the calculations can be found here: http://en.wikipedia.org/wiki/Calculating_the_day_of_the_week

2006-12-20 08:24:22 · answer #1 · answered by ChipChamp 4 · 0 0

Sure. Here's the algorithm:

Pick a starting date and day of the week. January 1, 2006 was a Sunday. Number the days of the week 0-6 where Sunday is 0 and Saturday is 6.
Convert the customer date to an integer number whose value is the number of days after January 1, 2006. Don't forget leap years in there.
Divide that integer number by 7 and keep the remainder (or modulus). Let's say that remainder is 5. Then the customer's date falls on a Friday (day 5).
Several computer languages have a function to convert the date to a number. REXX and COBOL are two.

I don't write programs in C.

2006-12-20 08:24:29 · answer #2 · answered by Thomas K 6 · 0 0

Most programs use the number like Julian date 43874 for the 2/13/2020. Knowing that a certain day was on Sunday will allow the number of days to show the day of the week.

But.... There is an easier way. Write the program following the mental calculation in the pubcrawler.org method. It will save time. Maybe even days.

2006-12-20 08:31:57 · answer #3 · answered by Steven A 3 · 0 0

somewhat i admire wet days whilst that's heat out so i can walk interior the rain. i'm no longer loopy approximately Mondays however. And right this moment we had a intense of sixty 5 and it became raining somewhat, however the rain became freezing chilly brrr.

2016-12-11 13:01:54 · answer #4 · answered by Anonymous · 0 0

You can use any calendar software to look at a month and see what day a particular date will be on.

2006-12-20 08:18:49 · answer #5 · answered by Anonymous · 0 0

asctime()
The function asctime() converts the time in the struct 'ptr' to a character string of the following format:

2006-12-20 08:37:48 · answer #6 · answered by Anonymous · 1 0

You mean like this...... http://www.timeanddate.com/calendar/

2006-12-20 08:23:52 · answer #7 · answered by Papa 7 · 0 0

fedest.com, questions and answers