Write to CSV using timestamp

fbergstrandfbergstrand Member Posts: 8 Contributor I
edited December 2018 in Help

Forum - 

 

I'm writing  to CSV using generate macro timestamp (date_str_custom(date_now(),"yyyy-MM-dd")) and then write CSV to the below location. E %{timestamp}.csv

This gives me the correct file name I wish it to have i.e. E todays date (ex. E 2017-11-29)

 

So far so good, however, when i open the file  he data and number fields are displayed as 

11/29/2017  12:00:00 AM (i want it to only be displayed as 11/29/2017)

1944564.0 (I want it only to be displayed as 1944564)

If i write to Excel I have the option to specify date format (yyyy-MM-dd) and number format (#) and I would want the same functionality for CSV.files. 

 

The reason I want it in CSV is becaused I'm running a process multiple times a day and need to upload this file into another system. Writing it to Excel and then convert it each time is manual and time consuming. 

 

Any ideas? 

 

 

 

Answers

  • Edin_KlapicEdin_Klapic Moderator, Employee, RMResearcher, Member Posts: 266  RM Data Scientist

    Hi @fbergstrand,

     

    Attributes of type Date are always stored with the Time. If you only want to have the date you need to convert the date to nominal, e.g. with the Operator Date to Nominal or Generate Attributes.

    For the numbers you could use the Operator Format numbers. The Numbers are then stored as nominal values. You could also define a pattern - in case you always want to have 2 floating point numbers in a different use case.

     

    Hope this helps.

     

    Best regards,

    Edin

    sgenzer
Sign In or Register to comment.