Page 1 of 1

Data conversion

Posted: Tue Feb 12, 2008 11:04 pm
by Narayana
Hi,

I am trying to convert a character date, format:

MM/DD/YY

to a date, format:

DD/MM/YYYY

In Server Edition, this was easily taken care of using oconv, but now tht we are moving onto EE, I am having difficulty. I tried the following:

DateToString(StringToDate(Trim(lkDatesStripped.DataOut), "%mm/%dd/%yy"), "%dd/%mm/%yyyy")

This however took input 02/11/07 and converted to 11/02/1907!

Any suggestions please.

Thanks

Posted: Tue Feb 12, 2008 11:29 pm
by balajisr
Try this.

Code: Select all

DateToString(StringToDate(Trim(lkDatesStripped.DataOut), "%mm/%dd/%yy"), "%dd/%mm/%2000yy") 
or

Set APT_DATE_CENTURY_BREAK_YEAR environment variable to 2000.

Posted: Thu Feb 14, 2008 1:48 am
by Narayana
But I do get the Data of '97 so if i am derivation as provided.. it iwill again give me the wrong output even if i set the Env variable to 2000.

Thanks for your reply

Posted: Thu Feb 14, 2008 3:22 am
by balajisr
Narayana wrote:But I do get the Data of '97 so if i am derivation as provided.. it iwill again give me the wrong output even if i set the Env variable to 2000.

Thanks for your reply
What happens if you specify as below:

Code: Select all

DateToString(StringToDate(Trim(lkDatesStripped.DataOut), "%mm/%dd/%yy"), "%dd/%mm/%1950yy") 
If it works replace 1950 with any number you like.