You need to write a program on Pascal: how to determine the day of the week by date (date, month, year)? Those. Enter the date, but should display the number of the day of the week. This program will serve as a procedure for a more complex program.
- Do not reinvent the wheel ... Use the possibilities of a programming language - timka_s
- The exact definition (taking into account the features of the transition to summer / winter time in a particular region or even by changing the calendar (RSFSR 1918)) for an arbitrary date (for example, many years ago) can be very difficult. Although, judging by the name of the question, this commentary is theoretical. - avp
- But how can the transition to winter / summer time affect the determination of the day of the week according to the date.month.year? - skegg
- oneCan procedures return value? - timka_s
- one@mikillskegg, you are right, there is nothing to stare at the terminal at night, you need to sleep. In general, the comment is inspired by memories of UTC and weekends at different airports. - avp
2 answers
Well, it depends on what language you are programming and perhaps you need to get this data from the database. In general, they translate the date and unicaststamp and then get what you want. If the DBMS, then it has great opportunities to work with time and date, you can already pull the data from the database in the form you want.
For example, here
However, I agree with @timka_s : it is better to use the standard time management tools provided by the language used.
The continuation of the banquet.
I now do not know Pascal, and then googled and immediately found the site
Function EncodeDate(Year, Moth, Day: Word): TDateTime; - creates a date type variable by day-month-year
Function DayOfWeek(Date: TDateTime): Integer; - calculates the day of the week by date