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

tlikarish
Employee
Employee

If you change the expression to this then you’ll get close. [note: I quoted the .txt]

Expression: “XXXXXXX_” + Date.now() + “.txt”
Result: XXXXX_2018-11-28T18:10:54.456Z.txt

You could further format the date by doing.

Expression: “XXXXXXX_” + Date.now().toLocaleDateTimeString({“format”:“yyyyMMddHHmmss”}) + “.txt”
Result: XXXXX_20181128181830.txt

Here is more documentation on the toLocaleDateTimeString.

Okay, I have tried both ways you have and it is still messing up. to give further explaination, my file name is a directory path to our FTP server and then the name. so for example. it is something like this…

/home/edi/BS/Trade/P41/out/“filename” + Date.now().toLocaleDateTimeString({“format”:“yyyyMMddHHmmss”}) + “.txt”

An on the server it is literally posting that as the name ^^

smakkena
New Contributor II

I am guessing you do NOT have the expression toggle on for the File name property…causing it to treat the value as literal text.

That makes it fail when I have it as an expression. Since it is on a server could that be an issue.

image