Page 1 of 1

Date conversion

Posted: Mon Jan 21, 2019 11:48 am
by rumu
Hi All,

I have a requirement to convert input string to date fomat yyyymmdd.
Input string is coming as 'yymmdd' format. Ie if input data is 190110, output should be 20190110.

I used the following conversion:

Code: Select all

DateToString( StringToDate(Lnk_TDCO.TRAIL_DATE,"%yy%mm%dd"),"%yyyy%mm%dd")
The out put I am getting as 19190110..The year is 1919 instead of 2019. How to rectify this?

Posted: Mon Jan 21, 2019 3:41 pm
by chulett
For one way, check here and then search for year_cutoff. Allows you to define what is also known as the "Century Pivot".

Posted: Tue Jan 22, 2019 7:02 am
by rumu
Thanks Craig,

To use date tag, do I need to use basic transformer?

Posted: Tue Jan 22, 2019 7:25 am
by chulett
Nope, not at all.

Posted: Tue Jan 22, 2019 8:00 am
by rumu
ok, then may be my expression is wrong hence getting parsing error.

If I want to extract cutoff year from the input field, I am using expression as below:

StringToDate(InputLink.Datestring,"%NNNNyy")

I am getting parsing error for this.

Posted: Tue Jan 22, 2019 8:06 am
by chulett
I assume you need to replace NNNN with the actual year to use as the cutoff / pivot year.

Posted: Tue Jan 22, 2019 8:33 am
by rumu
Thanks Craig. I set up cut off year as 2000 and received the desired output.