Conversion into meaningful date

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
palak08
Participant
Posts: 75
Joined: Thu Nov 04, 2010 5:54 pm

Conversion into meaningful date

Post by palak08 »

I have a parameter like abc2010_0428. I have to take last 9 digits and convert them in a meaning ful date like 04/28/2010(mm/dd/yyyy).
I used Right function to extrcat last 9 digits. Now how can I convert this in meaningful date?
Any help will be appreciated.
Thanks!
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Something like this:

Code: Select all

OConv(IConv(Convert("_","",YourDate),"DYMD"),"D/MDY[2,2,4]")
-craig

"You can never have too many knives" -- Logan Nine Fingers
palak08
Participant
Posts: 75
Joined: Thu Nov 04, 2010 5:54 pm

Post by palak08 »

Thanks. Only Iconv did the trick.
chulett wrote:Something like this:

Code: Select all

OConv(IConv(Convert("_","",YourDate),"DYMD"),"D/MDY[2,2,4]")
...
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

:? If you say so.

Iconv converts the date into an internal format, which is an integer value representing the number of days past the zero date. You really need OConv to get it back to the valid external format that your post shows - unless your target is a database column. Some will accept that internal format.
-craig

"You can never have too many knives" -- Logan Nine Fingers
nitkuar
Participant
Posts: 46
Joined: Mon Jun 23, 2008 3:09 am

Post by nitkuar »

Palak,
Could you please let us know your database and its version. Also if your query is resolved, please mark it as Closed.
palak08
Participant
Posts: 75
Joined: Thu Nov 04, 2010 5:54 pm

Post by palak08 »

Yes my target is database column perhaps why it accepted.
My understanding was the same that Iconv converts into internal format but it seems my target accepted it. I did not use Oconv.
chulett wrote::? If you say so.

Iconv converts the date into an internal format, which is an integer value representing the number of days past the zero date. You really need OConv to get it back to the valid external format that your post shows - unless your target is a database column. Some will accept that internal format.
Post Reply