Simulates getting the current time for a city. Args: query: The name of the city to get the current time for. Returns: A string with the current time information.
(query: str)
| 38 | |
| 39 | |
| 40 | def get_current_time(query: str) -> str: |
| 41 | """Simulates getting the current time for a city. |
| 42 | |
| 43 | Args: |
| 44 | query: The name of the city to get the current time for. |
| 45 | |
| 46 | Returns: |
| 47 | A string with the current time information. |
| 48 | """ |
| 49 | if "sf" in query.lower() or "san francisco" in query.lower(): |
| 50 | tz_identifier = "America/Los_Angeles" |
| 51 | else: |
| 52 | return f"Sorry, I don't have timezone information for query: {query}." |
| 53 | |
| 54 | tz = ZoneInfo(tz_identifier) |
| 55 | now = datetime.datetime.now(tz) |
| 56 | return f"The current time for query {query} is {now.strftime('%Y-%m-%d %H:%M:%S %Z%z')}" |
| 57 | |
| 58 | |
| 59 | # --- Memory Bank --- |
no outgoing calls