Answers for "how to get date in python"

12

get date and time python

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
31

python current date

from datetime import date

today = date.today()
print("Today's date:", today)
Posted by: Guest on April-15-2020
8

how to get the current date in flask python

from datetime import date
//today is an object so you can get the day, month and year by
//treating it as an object. eg: today.day, today.month, today.year
today = date.today()
print("Today's date:", today)
Posted by: Guest on March-26-2020
1

python Get the current date and time (datetime)

from datetime import datetime

# datetime object containing current date and time
now = datetime.now()
 
print("now =", now)

# dd/mm/YY H:M:S
dt_string = now.strftime("%d/%m/%Y %H:%M:%S")
print("date and time =", dt_string)	

# now = 2021-06-25 07:58:56.550604
# date and time = 25/06/2021 07:58:56
Posted by: Guest on August-16-2021
1

python get date and time

import datetime
now = datetime.datetime.now()
print ("Current date and time : ")
print (now.strftime("%Y-%m-%d %H:%M:%S"))
Posted by: Guest on March-02-2020
3

find todays date in python

from datetime import datetime

# Current date time in local system
print(datetime.now())
print(datetime.date(datetime.now())) ##For Date
Posted by: Guest on July-29-2020

Code answers related to "how to get date in python"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language