Problems with converting date times from/to UTC wi...
# support
r
Dear Vapi, we are facing issues with dynamic date time conversion within the call. We have developed an appointment setter assistant, which uses a tool that connect to our API to book appointment. Our API works with UTC and times should be sent in this way, but when presenting them to the customer should be converted to local times in the Europe/Berlin timezone. The problem is that this doesn't consistently work unfortunately, even if the prompt we specify this conversion requirement many times. I' m just wondering if you could have a look to our assistant prompt, and/or help us with some best practices for this kind of problem assistant id : 7741e7c2-95e4-4b81-870b-9abf9ca232c8 Thanks in advance 🙏
v
To consistently present UTC times in the Europe/Berlin timezone within your Vapi assistant, use the LiquidJS date filter in your prompt as follows:
Copy code
liquid
{{utc_time | date: "%A, %B %d, %I:%M %p", "Europe/Berlin"}}
Make sure
utc_time
is always an ISO 8601 UTC string when passed to the assistant. This will reliably convert and display the time in the correct local timezone for your users.
[See more in the Vapi documentation.](https://docs.vapi.ai/assistants/dynamic-variables#advanced-date-and-time-usage) Source: - [Vapi Dynamic Variables Documentation](https://docs.vapi.ai/assistants/dynamic-variables#advanced-date-and-time-usage)
k
Clearly specify UTC-to-Europe/Berlin conversion in the prompt, use reliable code, moment-timezone for dynamic conversions, ensure all tools handle time zones consistently, add error handling, and thoroughly test edge cases like daylight saving changes..