Code 45: Python program to print the current Date and Time | Datetime Module | 365 Days of Code

Published: 14 February 2021
on channel: Code House
456
4

Here is the program to print the current Date and Time using Python.
Code -
import datetime
curr_dt = datetime.datetime.now()
print(curr_dt) # Complete Date and Time
print(curr_dt.day) # Only Date
print(curr_dt.month) # Only Month
print(curr_dt.year) # Only Year
print(curr_dt.hour) # Only Hour
print(curr_dt.minute) # Only Minutes
print(curr_dt.second) # Only Seconds

Thanks


On this page of the site you can watch the video online Code 45: Python program to print the current Date and Time | Datetime Module | 365 Days of Code with a duration of hours minute second in good quality, which was uploaded by the user Code House 14 February 2021, share the link with friends and acquaintances, this video has already been watched 456 times on youtube and it was liked by 4 viewers. Enjoy your viewing!