Expand my Community achievements bar.

SOLVED

Format Date - ACS - need YYYYMMDD

Avatar

Level 4

Hello, 

 

I create an automation where a Scheduler attached to an END activity, that has 3 variables I've identified, and would kick off an External Signal in another workflow.  

 

The External signal goes right into a Transfer File activity and here's where I need help. The Transfer File will download a file located in an external SFTP. The filename contains a date field in it. 

 

I tried the following - $(vars/@FilePath)+$(vars/@FileMask)+Year(GetDate())+Month(GetDate())+Day(GetDate())+'.'+$(vars/@File_Extension) - but it returns this: 

 

outgoing/batch_push/2_167_USER_PROFILE_2020825.zip 

 

When I need it return this: outgoing/batch_push/2_167_USER_PROFILE_20200825.zip'

 

Can someone guide me on how to get this to be a 2 digit month. I tried LPad and some other coding and they failed. This isn't an issue for me in ACC since I can use a script, but I'm have a hard time in ACS. 

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hi,

 

Try <%= formatDate(new Date(), "%4Y%2M%2D") %>.txt

 

Thanks,

David

 



David Kangni

View solution in original post

4 Replies

Avatar

Correct answer by
Community Advisor

Hi,

 

Try <%= formatDate(new Date(), "%4Y%2M%2D") %>.txt

 

Thanks,

David

 



David Kangni

Avatar

Level 4

David - I continue to get an error. XTK-170037 '%' is a binary operator. At least one operand is missing

Avatar

Community Advisor

Try this

Year(GetDate())+''+ Iif(Month(GetDate())>9, Month(GetDate()), '0'+Month(GetDate())) +''+Day(GetDate())

or 

Substring(ToString(GetDate()),1, 4)+''+Substring(ToString(GetDate()),5, 2)+''+Substring(ToString(GetDate()),7, 2)

the number in red is ajustable regarding what your ToString(GetDate()) return

 

Thanks,

David



David Kangni