Date calculation in python

Use timedelta

import datatime

today = datetime.datatme.today()

#tomorrow
tomorrow = today + datetime.timedelta(days=1)

#Next week today
today_week = today + datetime.timedalta(days=7)

#Days from tomorrow to today next week
(today_week - tomorrow).days

Recommended Posts

Date calculation in python
Date calculation in Python
Get date in Python
Shapley value calculation in Python
String date manipulation in Python
Sort by date in python
Quantum chemistry calculation in Python (Psi4)
Accelerometer Alan Variance Calculation in Python
Python in optimization
CURL in python
Metaprogramming in Python
Python 3.3 in Anaconda
Geocoding in python
Python date arithmetic
Meta-analysis in Python
Unittest in python
Epoch in Python
Discord in Python
Sudoku in Python
DCI in Python
quicksort in python
nCr in python
N-Gram in Python
Programming in python
Plink in Python
Constant in python
Lifegame in Python.
FizzBuzz in Python
StepAIC in Python
N-gram in python
LINE-Bot [0] in Python
Csv in python
Disassemble in Python
Reflection in Python
Constant in python
nCr in Python.
format in python
Scons in Python3
Puyo Puyo in python
python in virtualenv
PPAP in Python
Quad-tree in Python
Reflection in Python
Chemistry in Python
Hashable in python
DirectLiNGAM in Python
LiNGAM in Python
Flatten in python
flatten in python
Let's make a combination calculation in Python
Time comparison: Correlation coefficient calculation in Python
Daily AtCoder # 36 in Python
Clustering text in Python
Implement Enigma in python
Daily AtCoder # 32 in Python
Daily AtCoder # 6 in Python
Daily AtCoder # 18 in Python
Edit fonts in Python
Singleton pattern in Python
File operations in Python
Read DXF in python