Current Date via Column Expressions

Hi,

I’ve seen this post: Workflow Example to add Current Date Column but would like to do this in the Column Expressions node.

I would like to add a new column based on the current date via the Column Expressions node.

I cannot get Date.now() to work or any other expressions to work. I am totally new to Javascript and the syntax (so I’m probably doing it wrong).

Any guidance would be greatly appreciated!

1 Like

Hi there!

This worked for me:

today = new Date();
date1 = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
time1 = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
dateTime1 = date1+' '+time1;

Source: https://tecadmin.net/get-current-date-time-javascript/

Just drop var :wink:

Br,
Ivan

4 Likes

@ipazin I got it to work as well! Thank you so much! Here is what I ended up doing (I didn’t like the single digit for the month.

today = new Date()
months = [“January”, “February”, “March”, “April”, “May”, “June”, “July”, “August”, “September”, “October”, “November”, “December”];
date1 = today.getFullYear()+‘-’+months[today.getMonth()]+‘-’+today.getDate();
dateTime1 = date1

1 Like

Cool :slight_smile:
Ivan

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.