Current Time
# support
f
The assistant need to be aware of the current time and give pricing based on the time of the call. I know you can use the date variable, but its not working. What is the best way to do this? I added this in my prompt: ## [Time Information] [Current Date and Time in UTC] {{now}} [Current Month] {{month}} [Time Conversion] Convert UTC time to Eastern Standard Time (EST) by: - Subtracting 5 hours during Standard Time (November to March). - Subtracting 4 hours during Daylight Saving Time (March to November). - EST (Eastern Standard Time) is the time zone for the Eastern part of the United States, which includes Miami. ## [Task Flow] 0. [Time Conversion] Convert the current UTC time to EST. Use this EST time for all time-related tasks and information provided to the caller. Determine whether the current date falls within Standard Time (subtract 5 hours) or Daylight Saving Time (subtract 4 hours) based on the current month.
v
@Francois It seems like you're trying to implement dynamic time-based pricing in your voice application using VAPI. To ensure the date variable is working correctly, you might need to check the implementation details in your code or the platform you're using. However, I can guide you on how to approach the time conversion based on the provided context. Since today is {{date}}, which is January 1, 2024, and the current UTC time is {{time}}, you are in the Standard Time period. Therefore, you should subtract 5 hours from the UTC time to convert it to Eastern Standard Time (EST). Here's how you can calculate the EST time: 1. Take the current UTC time: {{time}} (12:00 PM). 2. Since it's Standard Time (November to March), subtract 5 hours. 3. The result is the EST time: 7:00 AM. For pricing based on the time of the call, you would typically define pricing tiers depending on the time of day. For example, rates could be higher during peak hours and lower during off-peak hours. You would then apply these rates to the converted EST time. If you need to implement this in your VAPI application, you would use conditional logic to check the current EST time against your defined pricing tiers and apply the appropriate rate. If you're encountering issues with the date variable not working as expected, please provide more details or ask support for more info on this.
You can continue this conversation by mentioning me in the message.
Got it. Tagging @User for additional help.
f
@Shubham Bajaj
s
@Francois the dynamic variable
now
sometimes doesn't works as expected, can you add using server event request assistant by yourself instead.
f
Noted, thanks. Did that and it works
r
what did you use?
f
Created a new Tool called gettime. Instructed the assistant to use the gettime fucntion for time and made a make.com scnerario to get the time.
r
AI can take over the world but surely can't figure out what time it is
f
Haha
16 Views