Page 1 of 1

Iconv & Oconv logic

Posted: Thu Jul 07, 2011 12:55 am
by kamaldeep.kaur
Hi all,

I am using Oconv function to convert @DATE to YYYY/MM/DD format.
As @DATE output is 15894 which is today's date "07/07/2011".

But when i apply Oconv(@DAY,"D/YMD[4,2,2]") its gives output as "1968/01/07".

Please suggest how these Iconv and Oconv functions works and how i got the above error

Thanks
Kamal

Posted: Thu Jul 07, 2011 2:26 am
by ray.wurlod
@DAY is the day of the month. It only has values between 1 and 31. So applying that Oconv() function to it could only yield values in the range "1968-01-01" through "1968-01-31". Clearly you executed it on the seventh of the month.

To put it another way, @DAY and @DATE are not the same thing.

Posted: Mon Jul 11, 2011 11:26 pm
by kamaldeep.kaur
sorry it was typo i used @DATE instead of @DAY
Oconv(@DATE,"D/YMD[4,2,2]")

still i get "1968-01-07"??

Kamal

Posted: Tue Jul 12, 2011 12:48 am
by vasubabu
Try this

Oconv(iconv(@DATE,"D/E") ,"D/YMD[4,2,2]")

Posted: Wed Jul 13, 2011 2:41 am
by hemanthakumar
Hi Kamal,
The below code is working fine, it gives the correct output "2011/07/13"

Code: Select all

Oconv(@DATE,"D/YMD[4,2,2]") 
.

Posted: Wed Jul 13, 2011 6:34 am
by chulett
Yah, there was nothing wrong with the OConv you posted. If you still have the issue, show us exactly how/where you are using it, something else is causing the issue.

Posted: Wed Jul 13, 2011 9:23 am
by PhilHibbs
kamaldeep.kaur wrote:still i get "1968-01-07"??
So, 5 days later you still get the same result? Can't be the server clock set wrong then, I guess.