Iconv and Oconv Date Conversion

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
tanmaya
Participant
Posts: 38
Joined: Tue Jun 16, 2009 7:57 am
Location: Bangalore

Iconv and Oconv Date Conversion

Post by tanmaya »

Hi,

I have a problem using the iconv and oconv fuctions for the date conversion in Datastage 8.0.1. The format that i entered the date was mm/dd/yyyy and the output desired was yyyy/mm/dd but i got an output of yyyy mm dd.How can i add the slash in my output.

And, i would also like to know how I could convert to date in the form of
yy MON dd.
The fuction that I used is as follows.

Oconv(Iconv(InputFieldName,"D DMY[2,2,4]"),"D YMD[4,2,2]")

Thanks in Advance

Regards,
Tanmaya
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Welcome aboard. You specified space as the delimiter and that's what you got. What you needed was something like

Code: Select all

Oconv(Iconv(InputFieldName,"DMDY"),"D/YMD[4,2,2]") 
You might find this article informative.

For the second question, try

Code: Select all

Oconv(Iconv(InputFieldName,"DMDY"),"D YMD[2,A3,2]") 
Last edited by ray.wurlod on Wed Jun 17, 2009 1:41 am, edited 2 times in total.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
sachin1
Participant
Posts: 325
Joined: Wed May 30, 2007 7:42 am
Location: india

Re: Iconv and Oconv Date Conversion

Post by sachin1 »

Oconv(Iconv("06/17/2009" ,"D MDY[2,2,4]"),"D/YMD[4,2,2]") gives the output 2009/06/17.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Re: Iconv and Oconv Date Conversion

Post by ray.wurlod »

tanmaya wrote:... the output desired was yyyy/mm/dd
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
tanmaya
Participant
Posts: 38
Joined: Tue Jun 16, 2009 7:57 am
Location: Bangalore

Post by tanmaya »

ray.wurlod wrote:Welcome aboard. You specified space as the delimiter and that's what you got. What you needed was something like

Code: Select all

Oconv(Iconv(InputFieldName,"DMDY"),"D/YMD[4,2,2]") 
You might find this article informative.

For the second question, try

Code: Select all

Oconv(Iconv(InputFieldName,"DMDY"),"D YMD[2,A3,2]") 

Thank you Ray, that surely worked.

Regards,

Tanmaya
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Then time to mark your topic as Resolved using the button at the top of the page! :wink:
-craig

"You can never have too many knives" -- Logan Nine Fingers
Post Reply