Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -30,7 +30,9 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
30 |
# Create timezone object
|
31 |
tz = pytz.timezone(timezone)
|
32 |
# Get current time in that timezone
|
33 |
-
|
|
|
|
|
34 |
return f"The current local time in {timezone} is: {local_time}"
|
35 |
except Exception as e:
|
36 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
|
|
30 |
# Create timezone object
|
31 |
tz = pytz.timezone(timezone)
|
32 |
# Get current time in that timezone
|
33 |
+
# Just get the time, not the entire date and time
|
34 |
+
local_time = datetime.datetime.now(tz).strftime("%I:%M %p") # %I for 12-hour clock, %M for minutes, %p for AM/PM
|
35 |
+
#local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
36 |
return f"The current local time in {timezone} is: {local_time}"
|
37 |
except Exception as e:
|
38 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|