SGripen
TTypebot
•Created by Karina Nunes on 4/23/2024 in #help-and-questions
Automatically determine today's date
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;
6 replies
TTypebot
•Created by Karina Nunes on 4/23/2024 in #help-and-questions
Automatically determine today's date
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)==}} ?
6 replies