I have a function named CURRENTDATETIME
in Designer 2.0 that returns the current date and time, but the time is formatted as 12:23:35
. I need the time to include milliseconds, like 12:23:35:67
. Is there an alternative way to achieve this?
1 Like
@Ritik_Dixit, you can achieve this using a custom function.
function getCurrentDateTimeWithMilliseconds(includeDate = false) {
const now = new Date();
const hours = String(now.getHours()).padStart(2, '0');
const minutes = String(now.getMinutes()).padStart(2, '0');
const seconds = String(now.getSeconds()).padStart(2, '0');
const milliseconds = String(now.getMilliseconds()).padStart(3, '0'); // always 3 digits
return `${hours}:${minutes}:${seconds}:${milliseconds}`;
}
5 Likes