Difference between revisions of "TI-BASIC:Dayofwk"
From Learn @ Cemetech
Jump to navigationJump to search (Initial automated import) |
(Automated superscript correction) |
||
Line 5: | Line 5: | ||
|location=Press: | |location=Press: | ||
# [2ND] + [0] for the CATALOG | # [2ND] + [0] for the CATALOG | ||
− | # [X | + | # [X<sup>-1</sup>] to jump to the letter D |
# [ENTER] to insert the command | # [ENTER] to insert the command | ||
|compatibility=TI-84+/SE | |compatibility=TI-84+/SE | ||
Line 15: | Line 15: | ||
:dayOfWk(2007,12,30) | :dayOfWk(2007,12,30) | ||
− | The above code returns 1, because the 30 | + | The above code returns 1, because the 30<sup>th</sup> of December, 2007, is a Sunday. |
= Error Conditions = | = Error Conditions = | ||
− | * '''[[TI-BASIC:Errors#domain|ERR:DOMAIN]]''' is thrown if any of the arguments are non-integral, or the date does not exist, such as the 42 | + | * '''[[TI-BASIC:Errors#domain|ERR:DOMAIN]]''' is thrown if any of the arguments are non-integral, or the date does not exist, such as the 42<sup>nd</sup> of February. However, the year does not matter (a date that takes place in the year 10000 is valid). However, there are exceptions, even if some dates do exist, this error may still occur. If you attempt to calculate the previous day of week such as the previous day, the error may still occur. |
= Related Commands = | = Related Commands = |
Latest revision as of 22:24, 24 February 2016
Command Summary
Returns an integer from 1 to 7, each representing a day of the week, given a date.
Command Syntax
dayOfWk(year,month,day)
Menu Location
Press:
- [2ND] + [0] for the CATALOG
- [X-1] to jump to the letter D
- [ENTER] to insert the command
TI-84+/SE
2 bytes
dayOfWk(year,month,day) returns an integer from 1 to 7, each representing a separate day of the week. 1 represents Sunday, 2 represents Monday, and so on, until 7 goes with Saturday. The date format is different than the normal American format (month/day/year), so be careful to put the arguments in the right order.
:dayOfWk(2007,12,30)
The above code returns 1, because the 30th of December, 2007, is a Sunday.
Error Conditions
- ERR:DOMAIN is thrown if any of the arguments are non-integral, or the date does not exist, such as the 42nd of February. However, the year does not matter (a date that takes place in the year 10000 is valid). However, there are exceptions, even if some dates do exist, this error may still occur. If you attempt to calculate the previous day of week such as the previous day, the error may still occur.
Related Commands
See Also
- Day_Of_Week -- routine to calculate the day of the week