cancel
Showing results for 
Search instead for 
Did you mean: 

Time stamp on an end of a file

FalleurJ
New Contributor

Hello,

I am trying to figure out the time stamp features, and I can’t seem to get it to work.

I have on my file writer: “XXXXXXX_” + Date.now() + .txt

But that doesn’t work, Can someone inform me on what I need to do to correct this and get this to work? I want to have YYYYMMDDHHMMSS in the time stamp.

8 REPLIES 8

smakkena
New Contributor II

You need to double quote the “static text” part of your expression.

Again, I have done that and it is not working, I think it is cause it is being placed on a FTP server.

image

smakkena
New Contributor II

There should be a quote in the beginning (as the first character) and I don’t see it.

tlikarish
Employee
Employee

You’ll want to do something like this as the expression, but fill it in with the specifics of the hostname. As @smakkena points out, the sftp part needs to be surrounded in quotes. That creates a string that you concatenate with the Date experssion. Then you concatenate the “.txt” string on to the end.

"sftp://my.ftp.com/home/edi/BS/Trade/P41/out/filename" + Date.now().toLocaleDateTimeString({"format":"yyyyMMddHHmmss"}) + ".txt"

EDIT A colleague pointed out that the double quotes were being replaced by angled quotes by the community editor, which may also be impacting the parsing of the expression. You may need to correct that in the snap’s expression too.