Python Program To Print Current Date And Time In Format dd/mm/yyyy
Chapter:
Python
Last Updated:
22-09-2023 04:41:42 UTC
Program:
/* ............... START ............... */
import datetime
# Get the current date and time
current_datetime = datetime.datetime.now()
# Format the date and time as dd/mm/yyyy
formatted_datetime = current_datetime.strftime("%d/%m/%Y")
# Print the formatted date and time
print("Current Date and Time (dd/mm/yyyy):", formatted_datetime)
/* ............... END ............... */
Output
Current Date and Time (dd/mm/yyyy): 22/09/2023
Notes:
-
When you run this code, it will display the current date and time in the format "dd/mm/yyyy," where:
- %d represents the day of the month (01 to 31).
- %m represents the month (01 to 12).
- %Y represents the year with century as a decimal number (e.g., 2023).
Tags
Python program to print current date and time in format dd/mm/yyyy #Python date format dd-mm-yyyy #Python get current date without time