Answers for "timedelta()"

14

python datetime now

import datetime
print(datetime.datetime.now()) #datetime.datetime.now() is the syntax
Posted by: Guest on March-29-2020
14

python datetime now

import datetime
print(datetime.datetime.now()) #datetime.datetime.now() is the syntax
Posted by: Guest on March-29-2020
1

timedelta python

current_date = datetime.date.today()
delta = datetime.timedelta(80)
print(current_date - delta)
Posted by: Guest on June-24-2021
1

timedelta python

current_date = datetime.date.today()
delta = datetime.timedelta(80)
print(current_date - delta)
Posted by: Guest on June-24-2021
0

timedelta

>>> import datetime
>>> d1 = datetime.date.today()
>>> from dateutil.relativedelta import relativedelta
>>> d1 + relativedelta(months=1)
datetime.date(2012, 4, 8)

>>> d2 = datetime.date(year=2012,month=1,day=31)
>>> d2 + relativedelta(months=1)
datetime.date(2012, 2, 29)
Posted by: Guest on July-28-2021
0

timedelta

>>> import datetime
>>> d1 = datetime.date.today()
>>> from dateutil.relativedelta import relativedelta
>>> d1 + relativedelta(months=1)
datetime.date(2012, 4, 8)

>>> d2 = datetime.date(year=2012,month=1,day=31)
>>> d2 + relativedelta(months=1)
datetime.date(2012, 2, 29)
Posted by: Guest on July-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language