Correcting the retrieval of relevant documents

This commit is contained in:
Josako
2024-06-12 16:15:48 +02:00
parent be311c440b
commit fd510c8fcd
8 changed files with 62 additions and 28 deletions

View File

@@ -0,0 +1,19 @@
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