Page 1 of 1

Date convertion

Posted: Tue May 10, 2011 6:27 am
by subrat
Can anyone please through some light on converting DD/MM/YYYY format to YYYY-MM-DD format in PX?

Re: Date convertion

Posted: Tue May 10, 2011 6:56 am
by braj
subrat wrote:Can anyone please through some light on converting DD/MM/YYYY format to YYYY-MM-DD format in PX?
You can use below format:
StringToDate(DATE_COL,"%dd-%mmm-%1980yy")

where 1980 is cut-off year. hence it will convert 03-MAY-99 to 1999-05-03 and 05-NOV-05 to 2005-11-05.

Hope this helps.

Thanks
Brajesh.

Posted: Tue May 10, 2011 7:00 am
by chulett
The 1980 part is unneeded with a 4 digit year as is "mmm" with a 2 digit month. Are both of your examples strings? Or is one an actual Date? That changes the answer, but the StringToDate() and DateToString() functions are what you need to become familiar with.

Posted: Tue May 10, 2011 7:06 am
by braj
aah....I answered it for DD-MON-YY format...

for this format, simple thing is to use:

StringToDate(DATE_COL,"%dd/%mm/%yyyy")

Thanks
Brajesh.