Exp No 4 Write a python script to print the current date in the following format “Sun May 29 02:26:23 IST 2017
from datetime import datetime
today =datetime.today()
dd/mm/YY
d1 =today.strftime("%d/%m/%Y")
print("d1 =", d1)
mm/dd/y
d2 =today.strftime("%m/%d/%y")
print("d2 =", d2)
Month abbreviation, day and year
d3 =today.strftime("%b-%d-%Y")
print("d3 =", d3)
Textual month, day and year
d4 =today.strftime("%B %d, %Y")
print("d4 =", d4)
Experiment format “Sun May 29 02:26:23 IST 2017
d5 =today.strftime("%a %b %d %H:%M:%S, IST %Y")
print("d5 =", d5)
INPUT AND OUTPUT:
d1 = 08/01/2024
d2 = 01/08/24
d3 = Jan-08-2024
d4 = January 08, 2024
d5 = Mon Jan 08 15:32:02, IST 2024
Auf dieser Seite können Sie das Online-Video PYTHON PROGRAMMING LAB Exp 4 mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer DIWAKAR TIWARY 08 Januar 2024 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 206 Mal angesehen und es wurde von 4 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!