Is Javascript the best way to add date information?

I am preparing data to upload to a Data warehouse. I’d like to add data about the week and the year of the upload. Is there a transform that I’m missing that will allow me to do this easily or is the best way to insert columns and use Javascript?

Probably the easiest way is to add meta data when you import data:

But you could also do it with the Javascript transform. For example you can get the current year from:

return new Date().getFullYear()

Thank you, I ended up using both methods the opening Meta info is very helpful, thanks for pointing that out.

1 Like

Note also that the Calculate transform has some data related functions, such as weekOfYear.

1 Like