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
to split date from the date record in DDYYYY format
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 197
- Joined: Mon Feb 17, 2003 11:20 pm
- Location: India
Re: to split date from the date record in DDYYYY format
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
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.
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
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 aswhich 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.
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)
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.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Re: to split date from the date record in DDYYYY format
Thank you very much for your hlep.