!
I completed the program to find the date
Calculated here as of January 1st of the year and the date from now on.
I want to make a program on which day it is.
What function and what should we use?
https://docs.python.org/ko/3.7/library/datetime.html
The difference is 96 days and 0 is Monday. Please refer to the above help.
In [1]: from datetime import date
In [2]: s_date = date(2020, 1, 1)
In [3]: diff_date = date.today() - s_date
In [4]: diff_date
Out[4]: datetime.timedelta(days=96)
In [5]: target_date = date(2020, 1, 1) + diff_date
In [6]: target_date.weekday()
Out[6]: 0
>>> from datetime import date
>>> s_date = date(1, 1, 1)
>>> diff_date = date.today() - s_date
>>> diff_date
datetime.timedelta(days=737521)
>>> diff_date = date(2020, 3, 10) - s_date
>>> diff_date
datetime.timedelta(days=737493)
© 2024 OneMinuteCode. All rights reserved.