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
In questa pagina del sito puoi guardare il video online PYTHON PROGRAMMING LAB Exp 4 della durata di ore minuti seconda in buona qualità , che l'utente ha caricato DIWAKAR TIWARY 08 gennaio 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 206 volte e gli è piaciuto 4 spettatori. Buona visione!