Answers for "how to use datetime module in python"

2

import datetime

from datetime import datetime

date = datetime.now()
print(date)
# Prints in the format year, month, day, hour, minute, second, and microsecond
Posted by: Guest on February-15-2021
26

datetime python

from datetime import datetime as d
date = d.now()
print(date.strftime("%Y-%m-%d %H:%M:%S"))
Posted by: Guest on December-09-2020
5

python datetime module

import datetime as d
time = d.datetime.now()
time = time.strftime("%Y-%m-%d  %H:%M:%S")
           #year-#month-#date  #hour:#minure:#second
print(time)
Posted by: Guest on May-06-2021
4

python datetime

from datetime import date
f_date = date(2014, 7, 2)
l_date = date(2014, 7, 11)
delta = l_date - f_date
print(delta.days)
Posted by: Guest on October-26-2020
-3

datetime python

>>> timedelta(hours=-5)
datetime.timedelta(days=-1, seconds=68400)
>>> print(_)
-1 day, 19:00:00
Posted by: Guest on February-06-2021

Code answers related to "how to use datetime module in python"

Python Answers by Framework

Browse Popular Code Answers by Language