For the time being, pick up only the languages that are frequently used. It's surprisingly disjointed. I can understand the patterns derived from ISO 8601 and time.h, but why did this happen other than that?
language/tool | [1-7]=[Month-Day] | [0-6]=[Day-soil] | [0-6]=[Month-Day] | [1-7]=[Day-soil] |
---|---|---|---|---|
ISO 8601 | D | |||
SWI-Prolog | day_of_the_week/2 | |||
Python | date.isoweekday() | |||
Python | datetime.isoweekday() | |||
Ruby | Date#cwday | |||
Ruby | Date#wday | |||
JavaScript | Date.getDay | |||
C/C++ (time.h) | tm_wday | |||
CRONTAB (5) | day of week | |||
SRFI | date-week-day | |||
Python | date.weekday() | |||
Python | datetime.weekday() | |||
Java | java.util.Calendar |
ISO 8601
D
D represents the day of the week, Monday is 1 and Sunday is 7. "8" and "9" are not treated as notation values (handled as an error). http://ja.wikipedia.org/wiki/ISO_8601#.E5.B9.B4.E3.81.A8.E9.80.B1.E3.81.A8.E6.9B.9C.E6.97.A5
SWI-Prolog
day_of_the_week/2
Days of the week are numbered from one to seven: monday = 1, tuesday = 2, ..., sunday = 7. http://www.swi-prolog.org/pldoc/doc_for?object=date:day_of_the_week/2
Python
date.isoweekday()
Returns the day of the week as an integer, with Monday as 1 and Sunday as 7. http://docs.python.jp/3/library/datetime.html#date-objects
datetime.isoweekday()
Returns the day of the week as an integer, with Monday as 1 and Sunday as 7. http://docs.python.jp/3/library/datetime.html#datetime-objects
Ruby
Date#cwday
cwday -> Integer Returns the day of the week (day of the week) (1-7, 1 on Monday). http://docs.ruby-lang.org/ja/2.1.0/method/Date/i/cwday.html
Date#wday
wday -> Integer Returns the day of the week (0-6, zero on Sunday). http://docs.ruby-lang.org/ja/2.1.0/class/Date.html#I_WDAY
JavaScript
Date.getDay
0 on Sunday, 1 on Monday, 2 on Tuesday, and so on. https://developer.mozilla.org/ja/docs/Web/JavaScript/Reference/Global_Objects/Date/getDay
C/C++ (time.h)
tm_wday
days since Sunday – [0, 6] http://en.cppreference.com/w/c/chrono/tm
CRONTAB(5)
day of week
day of week 0-7 (0 or 7 is Sun, or use names) http://www.unix.com/man-page/linux/5/crontab/
SRFI (Scheme Requests for Implementation) 19
date-week-day date -> integer
The day of the week of this date, where Sunday=0, Monday=1, etc. http://srfi.schemers.org/srfi-19/srfi-19.html
Python
date.weekday()
Returns the day of the week as an integer, with Monday as 0 and Sunday as 6. http://docs.python.jp/3/library/datetime.html#date-objects
datetime.weekday()
Returns the day of the week as an integer, with Monday as 0 and Sunday as 6. http://docs.python.jp/3/library/datetime.html#datetime-objects
Java
java.util.Calendar
public static final int SUNDAY 1 http://docs.oracle.com/javase/jp/7/api/constant-values.html#java.util.Calendar.SUNDAY
Recommended Posts