42 lines
1.1 KiB
Python
42 lines
1.1 KiB
Python
from datetime import date, time, datetime, timedelta
|
|
import pytz
|
|
|
|
date_2026 = date(2026, 1, 10)
|
|
print(date_2026)
|
|
|
|
today = date.today()
|
|
print(today)
|
|
|
|
hour = time()
|
|
print(hour)
|
|
|
|
hour = time(12, 34, 23)
|
|
print(hour)
|
|
|
|
hour_now = datetime.now().time()
|
|
print(hour_now)
|
|
day_now = datetime.now().date()
|
|
print(day_now)
|
|
|
|
timezone_paris = pytz.timezone("Europe/Paris")
|
|
timezone_moscou = pytz.timezone("Europe/Moscow")
|
|
timezone_pyongyang = pytz.timezone("Asia/Pyongyang")
|
|
|
|
heure_actuelle_paris = datetime.now(tz= timezone_paris)
|
|
heure_actuelle_moscou = datetime.now(tz= timezone_moscou)
|
|
heure_actuelle_pyongyang = datetime.now(tz= timezone_pyongyang)
|
|
|
|
print(heure_actuelle_paris)
|
|
print(heure_actuelle_moscou)
|
|
print(heure_actuelle_pyongyang)
|
|
|
|
date_15_jours = date.today() + timedelta(days= 15)
|
|
print(date_15_jours)
|
|
|
|
debut_voyage = datetime(2026, 1, 16, 12, 7, 18, tzinfo= timezone_paris)
|
|
fin_voyage = datetime(2026, 12, 25, 13, 56, 23, tzinfo= timezone_pyongyang)
|
|
print(debut_voyage - fin_voyage)
|
|
|
|
detail_voyage = debut_voyage - fin_voyage
|
|
print(detail_voyage.days)
|
|
print(detail_voyage.seconds) |