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