Search code examples
timestampdataweaveanypoint-studiomule4writefile

Add an alphanumeric character in a timestamp


When writing to a csv file, how would i format the timestamp to include an alpha character 'T' like yyyy-MM-ddThh-mm-ss?

I have this in the path:

'File_Name_' ++ ( now() as String {format:'yyyy-MM-dd-hh-mm-ss'} ) ++ '.csv'

Above will produce File_Name_2022-10-25-13-22-01.csv

I need instead: File_Name_2022-10-25T13-22-01.csv


Solution

  • You are almost there:

    now() as String {format:"yyyy-MM-dd'T'hh-mm-ss"}
    

    Be careful of how you mix single quotes and double quotes. If you edit in the graphical view Studio will escape the quotes for you. In the XML view you need to do that yourself.