From c048527f384ed5cca7c02ffd47b6df4814481282 Mon Sep 17 00:00:00 2001 From: Davide Grilli Date: Mon, 4 May 2026 18:08:56 +0200 Subject: [PATCH] aggiunge esercizio 47 --- lab47.py | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lab47.py diff --git a/lab47.py b/lab47.py new file mode 100644 index 0000000..64e5c3b --- /dev/null +++ b/lab47.py @@ -0,0 +1,28 @@ +from datetime import datetime + +d = datetime(year=2020, month=11, day=4, hour=14, minute=53, second=0) + +# Direttive usate con strftime: +# %Y anno con 4 cifre -> 2020 +# %y anno con 2 cifre -> 20 +# %m mese numerico -> 11 +# %B nome mese completo -> November +# %b nome mese abbreviato -> Nov +# %d giorno del mese -> 04 +# %H ora formato 24h -> 14 +# %M minuti -> 53 +# %S secondi -> 00 +# %p AM/PM -> PM +# %a giorno abbreviato -> Wed +# %A giorno completo -> Wednesday +# %w giorno settimana -> 3 +# %j giorno dell'anno -> 309 +# %W numero settimana -> 44 + +print(d.strftime("%Y/%m/%d %H:%M:%S")) +print(d.strftime("%y/%B/%d %H:%M:%S %p")) +print(d.strftime("%a, %Y %b %d")) +print(d.strftime("%A, %Y %B %d")) +print(d.strftime("Weekday: %w")) +print(d.strftime("Day of the year: %j")) +print(d.strftime("Week number of the year: %W"))