to split date from the date record in DDYYYY format

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
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

to split date from the date record in DDYYYY format

Post by yaminids »

Hello there,

This is my first post even thougn I was reading other messages from a long time. I think its a great forum for anybody who wants information about Ascential products
Let me explain about my question. I am trying to separate date from a date record in 'ddyyyy' format. can anyone expalin to me how to achieve this.
Thanks in advance.

-Yamini
sumitgulati
Participant
Posts: 197
Joined: Mon Feb 17, 2003 11:20 pm
Location: India

Re: to split date from the date record in DDYYYY format

Post by sumitgulati »

Use Substrings function. All you want is the first two numbers from the date.

Substrings(<your date column name>,1,2)

Say your column name is CurrentDate then the function becomes:

Substrings(CurrnetDate, 1, 2)

Regards,
-Sumit
yaminids wrote:Hello there,

I am trying to separate date from a date record in 'ddyyyy' format. can anyone expalin to me how to achieve this.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

That's a very interesting date format. Did you mean dddyyyy or did you mean ddmmyy? I shall assume the former.

If the number of days is variable (1-366), Substrings() as suggested won't do it for you, you'll need something slightly more complex such as

Code: Select all

Left(TheDate, Len(TheDate)-4)
which takes all but the rightmost four characters from the string.

You can also use DataStage's date conversion functions. In this example the Iconv() function converts the date to an internal format, and the Oconv() function extracts the day number from this.

Code: Select all

Oconv(Iconv(TheDate, "D4JY"), "DJ")
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
yaminids
Premium Member
Premium Member
Posts: 387
Joined: Mon Oct 18, 2004 1:04 pm

Re: to split date from the date record in DDYYYY format

Post by yaminids »

Thank you very much for your hlep.
Post Reply