Page 1 of 1

Converting MM/DD/YY date to DD/MM/YYYY in EE

Posted: Fri May 12, 2006 10:43 am
by StuM
Hi All,

I am trying to convert a character date, format:

MM/DD/YY

to a character 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 05/11/06 and converted to 11/05/1906!

Any suggestions gratefully received.

Regards
StuM

Posted: Sat May 13, 2006 2:29 am
by ArndW
It seems that your settings for the $APT_DATE_CENTURY_BREAK_YEAR are such that this conversion works incorrectly. You can also specifically force a century for a 2 digit date by using %year_cutoffyy two digit year from year_cutoff (e.g. %2000yy)

Posted: Sat May 13, 2006 2:35 am
by StuM
ArndW wrote:It seems that your settings for the $APT_DATE_CENTURY_BREAK_YEAR are such that this conversion works incorrectly. You can also specifically force a century for a 2 digit date by using %year_cutoffy ...


Thanks very much for the info, I shall have a play and see how it goes.

Cheers
StuM

Posted: Fri May 19, 2006 8:16 am
by StuM
Thanks again - use of %year_cutoffyy achieved the desired result.

Could anyone tell me how this works. I am using %2000yy. What theoretically will happen in 2100?

Thanks in advance.
StuM

Posted: Fri May 19, 2006 9:24 am
by Lotus26
StuM wrote:Thanks again - use of %year_cutoffyy achieved the desired result.

Could anyone tell me how this works. I am using %2000yy. What theoretically will happen in 2100?

Thanks in advance.
StuM
I think it works same. The behaviour will not change.

Rgds
Lotus

Posted: Sat May 20, 2006 6:14 am
by kumar_s
Four digit year which marks the century two-digit dates belong to. It is
set to 1900 by defult.

At 2100 $APT_DATE_CENTURY_BREAK_YEAR should be changed to 2100.

Posted: Sat May 20, 2006 6:30 am
by StuM
Great, thanks very much for your help.

Regards
StuM