Day of week: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 81: | Line 81: | ||
* [https://support.office.com/zh-tw/article/WEEKDAY-%E5%87%BD%E6%95%B8-60e44483-2ed1-439f-8bd0-e404c190949a WEEKDAY 函數 - Office 支援] | * [https://support.office.com/zh-tw/article/WEEKDAY-%E5%87%BD%E6%95%B8-60e44483-2ed1-439f-8bd0-e404c190949a WEEKDAY 函數 - Office 支援] | ||
* [https://en.wikipedia.org/wiki/ISO_8601 ISO 8601 - Wikipedia] | * [https://en.wikipedia.org/wiki/ISO_8601 ISO 8601 - Wikipedia] | ||
* [https://stackoverflow.com/questions/23020162/how-to-get-this-coming-sundays-date mysql - How to get this coming Sunday's date? - Stack Overflow] | |||
[[Category:PHP]] | [[Category:PHP]] | ||
Revision as of 13:40, 21 August 2017
Numeric representation of the day of the week
| Day | Sunday | Monday | Tuesday | Wednesday | Thursday | Friday | Saturday |
|---|---|---|---|---|---|---|---|
| Weekday (ISO-8601 PHP date N character) | 7 | 1 | 2 | 3 | 4 | 5 | 6 |
| Weekday (MySQL) | 6 | 0 | 1 | 2 | 3 | 4 | 5 |
| Weekday (Excel) | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
| Weekday (PHP date w character) | 0 | 1 | 2 | 3 | 4 | 5 | 6 |
| Last week | SELECT CURDATE() + INTERVAL -8 - WEEKDAY(CURDATE()) DAY; | ||||||
| This week | SELECT CURDATE() + INTERVAL -1 - WEEKDAY(CURDATE()) DAY; | SELECT CURDATE() + INTERVAL 0 - WEEKDAY(CURDATE()) DAY; | SELECT CURDATE() + INTERVAL 1 - WEEKDAY(CURDATE()) DAY; | SELECT CURDATE() + INTERVAL 2 - WEEKDAY(CURDATE()) DAY; | SELECT CURDATE() + INTERVAL 3 - WEEKDAY(CURDATE()) DAY; | SELECT CURDATE() + INTERVAL 4 - WEEKDAY(CURDATE()) DAY; | SELECT CURDATE() + INTERVAL 5 - WEEKDAY(CURDATE()) DAY; |
| Next week | SELECT CURDATE() + INTERVAL 6 - WEEKDAY(CURDATE()) DAY; |
further reading
- PHP date function: w character (0 for Sunday through 6 for Saturday) or N character (1 for Monday through 7 for Sunday)
- WEEKDAY 函數 - Office 支援
- ISO 8601 - Wikipedia
- mysql - How to get this coming Sunday's date? - Stack Overflow