Answers for "python date class"

12

python date and time

from datetime import datetime
now = datetime.now()
print (now.strftime("%Y-%m-%d %H:%M:%S"))


Output: 2020-06-19 10:34:45
Posted by: Guest on June-19-2020
12

python date and time

from datetime import datetime
now = datetime.now()
print (now.strftime("%Y-%m-%d %H:%M:%S"))


Output: 2020-06-19 10:34:45
Posted by: Guest on June-19-2020
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
15

date in python

import time
import datetime

print(time.time())
# 1586813438.419919

print(time.ctime())
# Mon Apr 13 23:30:38 2020

print(datetime.datetime.now())
# 2021-11-13 23:30:38.419951

print(datetime.date.today())
# 2021-11-13
Posted by: Guest on November-04-2021
15

date in python

import time
import datetime

print(time.time())
# 1586813438.419919

print(time.ctime())
# Mon Apr 13 23:30:38 2020

print(datetime.datetime.now())
# 2021-11-13 23:30:38.419951

print(datetime.date.today())
# 2021-11-13
Posted by: Guest on November-04-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
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

Python Answers by Framework

Browse Popular Code Answers by Language