Working with Date and Time Format in Python programming to get Computer's current date and time in different formats by using a standard Date and Time 'datetime' library of Python programming language.
import datetime
print(datetime.date.today().strftime("%d")) #printing Current Day.
import datetime
print(datetime.date.today().strftime("%d/%m/%Y"))
import datetime
print(datetime.date.today().strftime("%A, %d %B,%Y"))
import datetime
mydate = datetime.date(1943, 3, 13) #assigning year, month, day to
print(mydate.strftime("%d/%B/%Y")) #'mydate' and printing.
import time
import datetime
print("Time in seconds since the epoch: %s" %time.time())
print("Current date and time: ", datetime.datetime.now())
print("Or like this: ", datetime.datetime.now().strftime("%y-%m-%d-%H-%M"))
print("Current year: ", datetime.date.today().strftime("%Y"))
print("Month of year: ", datetime.date.today().strftime("%B"))
print("Week number of the year: ", datetime.date.today().strftime("%W"))
print("Weekday of the week: ", datetime.date.today().strftime("%w"))
print("Day of year: ", datetime.date.today().strftime("%j"))
print("Day of the month : ", datetime.date.today().strftime("%d"))
print("Day of week: ", datetime.date.today().strftime("%A"))