Page 1 of 1

to split date from the date record in DDYYYY format

Posted: Mon Oct 18, 2004 1:14 pm
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

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

Posted: Mon Oct 18, 2004 2:20 pm
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.

Posted: Mon Oct 18, 2004 3:56 pm
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")

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

Posted: Tue Oct 19, 2004 11:20 am
by yaminids
Thank you very much for your hlep.