Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -42,14 +42,14 @@ def get_current_time_in_timezone(timezone: str) -> datetime:
|
|
42 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
43 |
@tool
|
44 |
def get_time_zone_string(local_time: datetime, timezone:str) -> str:
|
45 |
-
"""A tool that converts the datetime
|
46 |
Args:
|
47 |
local_time: A datetime object of the local time zone
|
48 |
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
49 |
"""
|
50 |
try:
|
51 |
-
|
52 |
-
return f"Local time in {timezone} is {
|
53 |
except Exception as e:
|
54 |
return f"Error converting '{local_time}' to string: {str(e)}"
|
55 |
|
|
|
42 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
43 |
@tool
|
44 |
def get_time_zone_string(local_time: datetime, timezone:str) -> str:
|
45 |
+
"""A tool that converts the datetime object to a string format for a response to the user.
|
46 |
Args:
|
47 |
local_time: A datetime object of the local time zone
|
48 |
timezone: A string representing a valid timezone (e.g., 'America/New_York').
|
49 |
"""
|
50 |
try:
|
51 |
+
local_time_str = local_time.strftime("%Y-%m-%d %H:%M:%S")
|
52 |
+
return f"Local time in {timezone} is {local_time_str}"
|
53 |
except Exception as e:
|
54 |
return f"Error converting '{local_time}' to string: {str(e)}"
|
55 |
|