Ilyass
Ilyass7h ago

Access to CURRENT date and time

Hey, I want that my agent have access to the exact date and time for each conversation because when someone asks, ‘Where are you?’ the AI has to ask what time it is each time to provide the information. So I tried the code that you gave us some months ago but it's not working for me. Does someone have a solution to fix that ? (For french time btw) Thank you!
No description
2 Replies
majinnboo
majinnboo5h ago
current date and time for Paris is lundi 29 septembre 2025 à 13:30:35 UTC+2 and here is the voice-flow javascript const now = new Date(); // Explicitly set the timeZone to Paris (France) Time. const optionsParis = { timeZone: 'Europe/Paris', // Paris (France) Time identifier // DATE Options weekday: 'long', // e.g., "lundi" year: 'numeric', month: 'long', // e.g., "septembre" day: 'numeric', // TIME Options hour: 'numeric', minute: 'numeric', second: 'numeric', // Locale and Time Zone Name timeZoneName: 'short' // e.g., "CEST" }; // This forces the date and time to be displayed according to the Paris Time Zone. // Using 'fr-FR' locale for typical French formatting (e.g., "lundi 29 septembre 2025 à 13:27:12 CEST"). var dateTimeParis = now.toLocaleString('fr-FR', optionsParis); console.log(Current Paris (France) Date and Time: ${dateTimeParis}); Variable to create in voiceflow would be {dateTimeParis}
Ilyass
IlyassOP4h ago
hey thank you for your help ! But it's not working for me, maybe i'm doing something wrong?

Did you find this page helpful?