Create a valid data format

Hi everyone.

I’m new to CloverETL and i’m playing a bit with it.

I have a .csv file as input. A column of this file represents a date as a string like this: 201210

I’m trying to write the file to the output as xlsx format in which the date column is of type date.

Using the example above, i would have: (string) 201210 ----> (date) 2012-10

For now, i’ve managed to get this: (string) 201210 ----> (string) 2012-10, by using the reformat component and a bit of
CTL coding.

Should i add a second reformat componet that in turn takes the string (2012-10) and maps it to a date, or there is a better way?

Thank you!

Hi,

Since “2012-10” is not a valid date - just year & month, you will need (ideally in a Reformat) add a day info. You can just append “01” for the first day in any particular month and then use str2date() function with mask like “yyyy-MM-dd” or you can use “yyyyMMdd” and skip parsing&adding those hyphens.

Thank you for your answer. I did it, but i used two reformat in sequence.