Spaces:
Sleeping
Sleeping
File size: 1,010 Bytes
6f9f2ac 56d5ffb 81d47a9 56d5ffb 6f9f2ac 56d5ffb 81d47a9 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | from datetime import datetime
from typing import Tuple
class TimeEngine:
@staticmethod
def get_season() -> str:
"""Get current season based on month"""
month = datetime.now().month
if month in [12, 1, 2]:
return "winter"
elif month in [3, 4, 5]:
return "spring"
elif month in [6, 7, 8]:
return "summer"
else:
return "autumn"
@staticmethod
def get_time_of_day() -> str:
"""Get time of day for context"""
hour = datetime.now().hour
if hour < 12:
return "morning"
elif hour < 18:
return "afternoon"
else:
return "evening"
@staticmethod
def get_current_date() -> str:
"""Get current date (YYYY-MM-DD)"""
return datetime.now().strftime("%Y-%m-%d")
@staticmethod
def get_current_time() -> str:
"""Get current time (HH:MM)"""
return datetime.now().strftime("%H:%M") |