Question
I am considering managing output files by date and time.
Is it possible to combine a timestamp with a file name to output?
Answer
Yes, you can combine file names with timestamps by using script variables, Current Date/Time logic, and Date/Time Formatting logic.
To do so, assign the date and time in desired format to a script variable and then name the output file like "FileName_${VariableName}.csv" in an operation to output a file (e.g., Write CSV File).
- Obtain the current date and time using Current Date/Time logic.
- Convert the current date/time obtained in step 1 into a string in desired format using Date/Time Formatting logic*.
- Assign the string obtained in step 2 into a script variable.
- Use the script variable in the File field of an operation such as Write CSV File.
Setting example for Date/Time Formatting logic*
Format: Specify the format for converting date/time to string.
<Example>
Obtained date and time: 2022-05-13 18:20:04
"yyyyMMdd" -> 20220513
"HHmmss" -> 182004
"YYYY-MM-DD-HH:mm:ss" -> 2022-05-13-18:20:04
For more information on the logics, please also refer to the following pages.
Comments
0 comments
Article is closed for comments.