Files
eveAI/common/utils/datetime_utils.py

20 lines
515 B
Python

from datetime import datetime
import pytz
def get_date_in_timezone(timezone_str):
try:
# Get the timezone object from the string
timezone = pytz.timezone(timezone_str)
# Get the current time in the specified timezone
current_time = datetime.now(timezone)
# Extract the date part
current_date = current_time.date()
return current_date
except Exception as e:
print(f"Error getting date in timezone {timezone_str}: {e}")
return None