Update app.py
Browse files
app.py
CHANGED
|
@@ -31,18 +31,8 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 31 |
#local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 32 |
#return f"The current local time in {timezone} is: {local_time}"
|
| 33 |
#################################
|
| 34 |
-
now = datetime.datetime.now(tz)
|
| 35 |
-
|
| 36 |
-
hour_min = now.strftime("%-I:%M %p") # 6:05 PM
|
| 37 |
-
month_year = now.strftime("%b %Y") # Jan 2026
|
| 38 |
-
day = now.day
|
| 39 |
-
|
| 40 |
-
# Ordinal suffix logic
|
| 41 |
-
suffix = "th" if 11 <= day <= 13 else {1: "st", 2: "nd", 3: "rd"}.get(day % 10, "th")
|
| 42 |
-
|
| 43 |
-
formatted_time = f"{hour_min} {now.strftime('%b')} {day}{suffix} {now.year}"
|
| 44 |
|
| 45 |
-
return f"The current local time in {timezone} is:
|
| 46 |
########################
|
| 47 |
except Exception as e:
|
| 48 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
|
|
|
| 31 |
#local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
|
| 32 |
#return f"The current local time in {timezone} is: {local_time}"
|
| 33 |
#################################
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
|
| 35 |
+
return f"The current local time in {timezone} is: Hahahaaa"
|
| 36 |
########################
|
| 37 |
except Exception as e:
|
| 38 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|