This expression provides a straightforward way to get the current date. It’s useful for creating dynamic date displays. Apply it to the Source Text property of the text layer.
d = new Date(Date(0));
// Format Settings
divider = “/”
yearLength = 2; // use 2 for YY, 4 for YYYY
// Format Settings
divider = “/”
yearLength = 2; // use 2 for YY, 4 for YYYY
function padZeros(n){
if(n <= 9){
return “0” + n;
}
return n
}
yearTrim = (yearLength===2) ? 2 : 0;
“” + padZeros(d.getMonth()+1) + divider + padZeros(d.getDate()) + divider + d.getFullYear().toString().substring(yearTrim,4);Pro tip: Go to AEJuice Pack Manager – Expressions Pack to apply this expression in 1 click. Here are direct links for the latest plugin version:
Windows / macOS
if(n <= 9){
return “0” + n;
}
return n
}
yearTrim = (yearLength===2) ? 2 : 0;
“” + padZeros(d.getMonth()+1) + divider + padZeros(d.getDate()) + divider + d.getFullYear().toString().substring(yearTrim,4);Pro tip: Go to AEJuice Pack Manager – Expressions Pack to apply this expression in 1 click. Here are direct links for the latest plugin version:
Windows / macOS