Liea commited on
Commit
c06f859
·
verified ·
1 Parent(s): 18ca685

change get_current_time_in_timezone * update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -9
app.py CHANGED
@@ -94,15 +94,16 @@ def get_current_time_in_timezone(timezone: str) -> str:
94
  Args:
95
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
96
  """
97
- # try:
98
- # # Create timezone object
99
- # tz = pytz.timezone(timezone)
100
- # # Get current time in that timezone
101
- # local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
102
- # return f"The current local time in {timezone} is: {local_time}"
103
- # except Exception as e:
104
- # return f"Error fetching time for timezone '{timezone}': {str(e)}"
105
- return "What magic time you see ?"
 
106
 
107
 
108
  final_answer = FinalAnswerTool()
 
94
  Args:
95
  timezone: A string representing a valid timezone (e.g., 'America/New_York').
96
  """
97
+ try:
98
+ # Create timezone object
99
+ tz = pytz.timezone(timezone)
100
+ # Get current time in that timezone
101
+ local_time = datetime.datetime.now(tz).strftime("%Y-%m-%d %H:%M:%S")
102
+ #return f"The current local time in {timezone} is: {local_time}"
103
+ return "What magic time you see ?"
104
+ except Exception as e:
105
+ return f"Error fetching time for timezone '{timezone}': {str(e)}"
106
+
107
 
108
 
109
  final_answer = FinalAnswerTool()