โ08-26-2022 11:39 AM
I have a pipeline that generates an output file that I would like to save in S3 with a file path of
YYYY/MM/dd/file_nameโฆ e.g. S3://bucket/2023/08/09/file_name.csv. When I do this:
โs3:///bucket/โ+Date.now().getFullYear()+โ/โ+Date.now().getMonth()+โ/โ+Date.now().getDate()+โ/fil_name.csvโ
It generates a path of 2023/8/9, How can I programmatically determine when to pad it with a โ0โ for single digit months and days without including this data in the document being saved?
โ08-26-2022 12:59 PM
Personally I like pipe.startTime over Date.now() since it is consistent throughout your pipeline execution and correlates to your pipeline execution time in the Dashboard - try this:
"s3:///bucket/" + pipe.startTime.toLocaleDateString( { format : "yyyy/MM/dd" } ) + "/filename.csv"
This should yield what youโre looking for.
โ09-20-2022 09:31 AM
I placed the logic in the csv formatter and stored it as a variable and used the variable as part of the path used by the writer snap. This worked.