How to get the exact time and timezone?
# support
r
Hi I am trying to utilize the {{now}} dynamic variable in my prompt to give me the exact time, however it only uses UTC time zone. I am trying to use PST (pacific time zone) and have tried this dynamic variable: {{"now" | date: "%b %d, %Y, %I:%M %p", "America/Los_Angeles"}} however it does not work correctly when I test it. I have figured out that the prompt is having a hard time converting UTC to PST because any time I give it is +7 hours from actual PST time. Please let me know how to get the exact accurate date and time when prompting the voice agent.
v
Try using separate variables for date, time, and day in your prompt to improve accuracy:
Copy code
Today is {{\"now\" | date: \"%A\", \"America/Los_Angeles\"}} 
The current date is {{\"now\" | date: \"%B %d, %Y\", \"America/Los_Angeles\"}}
The current time is {{\"now\" | date: \"%I:%M %p\", \"America/Los_Angeles\"}}
This approach has helped other users resolve timezone issues, particularly when switching to the gpt-4o model. Sources: - [Discord post about timezone issues](https://discord.com/channels/1211482211119796234/1325196797102260304) - [Discord post about separate variables](https://discord.com/channels/1211482211119796234/1342347443114872863)
Try using separate variables for date, time, and day in your prompt to improve accuracy:
Copy code
Today is {{\"now\" | date: \"%A\", \"America/Los_Angeles\"}} 
The current date is {{\"now\" | date: \"%B %d, %Y\", \"America/Los_Angeles\"}}
The current time is {{\"now\" | date: \"%I:%M %p\", \"America/Los_Angeles\"}}
This approach has helped other users resolve timezone issues, particularly when switching to the gpt-4o model. Sources: - [Discord post about timezone issues](https://discord.com/channels/1211482211119796234/1325196797102260304) - [Discord post about separate variables](https://discord.com/channels/1211482211119796234/1342347443114872863)
I am using anthropic (claude 3.7) for my model
I copied directly from here and it worked, but I'm using openAI
r
Same here but it does not work for me with Anthropic
k
Use {{ "now" | date: "%b %d, %Y, %I:%M %p", "America/Los_Angeles" }}, this should handle daylight saving time automatically, if you’re still getting a +7 offset, ensure no caching or misconfigured timezone is affecting the result..
4 Views