Construct a date from a string

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
anilkona
Participant
Posts: 50
Joined: Mon Nov 15, 2004 6:18 pm

Construct a date from a string

Post by anilkona »

Hello,

I am trying to construct a date from string like

IConv("2004-1-1","yyyymmdd")

This does not seem to work. I am trying to insert this in to a DB2 database table and column is of type 'Date'.

Any help is appreciated.

thanks,
-Anil
chucksmith
Premium Member
Premium Member
Posts: 385
Joined: Wed Jun 16, 2004 12:43 pm
Location: Virginia, USA
Contact:

Post by chucksmith »

Try:

Code: Select all

Iconv("2004-01-01", "D4-YMD[4,2,2]")
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Search this forum for "DB2" and "date" and you'll get to learn all the issues with using the plugin with dates. My apologies in advance...
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

The second argument of Oconv() and Iconv() when dealing with dates always begins with "D". It is NOT a date picture.

Bring up on-line help on topic "D" (actually "D Code (BASIC)") for more information, or visit Date Conversion Demystified
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Post Reply