[PYTHON] Numerical representation of days of the week in various languages

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

Numerical representation of days of the week in various languages
Find the number of days in a month
HMAC in various languages
Try to display the Fibonacci sequence in various languages in the name of algorithm practice
The popularity of programming languages
I implemented N-Queen in various languages and measured the speed
[AOJ] Descending sort in various languages
The story of participating in AtCoder
Summary of various operations in Tensorflow
The story of the "hole" in the file
The meaning of ".object" in Django
Predict the amount of electricity used in 2 days and publish it in CSV
Generate a list packed with the number of days in the current month.
Trends in programming languages from the perspective of GitHub (updated semi-annual changes)
[Understanding in 3 minutes] The beginning of Linux
Check the behavior of destructor in Python
The story of an error in PyOCR
Implement part of the process in C ++
Summary of various for statements in Python
Basic writing of various programming languages (self-memo)
The result of installing python in Anaconda
Let's claim the possibility of pyenv-virtualenv in 2021
The basics of running NoxPlayer in Python
Various comments to write in the program
In search of the fastest FizzBuzz in Python
Various ways to read the last line of a csv file in Python
Django shift creation function Added basic work shift registration function for days of the week
You will be an engineer in 100 days --Day 29 --Python --Basics of the Python language 5
You will be an engineer in 100 days --Day 33 --Python --Basics of the Python language 8
You will be an engineer in 100 days --Day 26 --Python --Basics of the Python language 3
Understand the images of various matrix operations used in Keras (Tensorflow) with examples
You will be an engineer in 100 days --Day 32 --Python --Basics of the Python language 7
Try to display the railway data of national land numerical information in 3D
You will be an engineer in 100 days --Day 28 --Python --Basics of the Python language 4
Output the number of CPU cores in Python
The meaning of {version-number} in the mysql rpm package
[Python] Sort the list of pathlib.Path in natural sort
Change the font size of the legend in df.plot
Get the caller of a function in Python
Match the distribution of each group in Python
View the result of geometry processing in Python
Transition animation of the most popular programming languages (#programming languages #popular)
Make a copy of the list in Python
Read the output of subprocess.Popen in real time
Find the divisor of the value entered in python
The story of finding the optimal n in N fist
Fix the argument of the function used in map
Find the solution of the nth-order equation in python
The story of reading HSPICE data in Python
[Note] About the role of underscore "_" in Python
Put the second axis in 2dhistgram of matplotlib
About the behavior of Model.get_or_create () of peewee in Python
Solving the equation of motion in Python (odeint)
Visualized the usage status of the sink in the company
Output in the form of a python array
Find out the day of the week with datetime
The story of viewing media files in Django
Search by the value of the instance in the list
Make progress of dd visible in the progress bar
Factfulness of the new coronavirus seen in Splunk
[Python] Get the day of the week (English & Japanese)