T
Typebot•4mo ago
Karina Nunes

Automatically determine today's date

Hello could you please help me? How can my assistant automatically determine today's date?
5 Replies
Baptiste
Baptiste•4mo ago
Use a Set variable block with the Now option 🙂
SGripen
SGripen•2w ago
Hi Batiste! I tried to use JS to format Now's output into a variable, for example {{data_agora}}, I looked in the documentation but couldn't find it. How can I format this date to DD/MM/YYYY? How to concatenate inline? {{=={{date_now}}.formatDate(DD:MM:YY)==}} ?
Mario Barretta
Mario Barretta•2w ago
I use this variable const currentDate = new Date(); const humanFriendlyDate = currentDate.toLocaleString(); return humanFriendlyDate; so to can have the variable that's manageable in my flow with this format DD/MM/YYYY, HH:MM:SS AM
SGripen
SGripen•2w ago
Perfetto! Thanks! const currentDate = new Date(); // Format date DD/MM/YYYY function formatDate(date) { const day = String(date.getDate()).padStart(2, '0'); const month = String(date.getMonth() + 1).padStart(2, '0'); // Month init 0 const year = date.getFullYear(); return ${day}/${month}/${year}; } const humanFriendlyDate = formatDate(currentDate); return humanFriendlyDate;
Mario Barretta
Mario Barretta•2w ago
happy to have helped you