#----------------------------- 1 - installing datetime library -----------------------
i). Go to command prompt
ii). After opening type : pip install datetime or type : ( python -m pip install datetime )
#----------------------------- 2 - Retrieving the todays information ----------------
import datetime # pip install datetime
today = datetime.datetime.now()
print(today) # give the current date , time in Hr.Min.Sec
#----------------------------- 3 - Retrieving the specified date informations -------
import datetime as dt # pip install datetime
year = dt.datetime(2023,10,10,1,3) #(year, month, day, Hours, Minutes, Seconds)
print(year.year) # gives the current year
print(year.strftime("%A")) # %A gives the day
print(year.strftime("%B")) # %B gives the Month
print(year.strftime("%C")) # %C gives the Century
print(year.strftime("%D")) # %D gives the Date
print(year.strftime("%H")) # %A gives the Hour
print(year.strftime("%j")) # % j gives the day number (from 1 - 366)
print(year.strftime("%M")) # %M gives the Minutes
print(year.strftime("P")) # %P gives the mode of time (AM/PM)
print(year.strftime("%T")) # %T gives the time format (HH:MM:SS)
print(year.strftime("%Y")) # %Y gives the Year
print(year.strftime("%z")) # %Z gives the Time zone