Month from Date YYYY-MM-DD

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
sush26283
Participant
Posts: 68
Joined: Thu May 20, 2010 11:55 am

Month from Date YYYY-MM-DD

Post by sush26283 »

Hi,
I have a querry, a small one...I hope someone can help me out with it.

I need to extract just the month from the date which is in format YYYY-MM-DD. can some one help me out with it.

Thanks in advance
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

This date... is it an actual Date datatype or is it a string? For the former, there are functions to get that, for the latter you can use substring.

Also, you marked the job as Server yet posted in the PX forum, which job type is it? That will change the answer as to the function needed.
-craig

"You can never have too many knives" -- Logan Nine Fingers
sush26283
Participant
Posts: 68
Joined: Thu May 20, 2010 11:55 am

Post by sush26283 »

chulett wrote:This date... is it an actual Date datatype or is it a string? For the former, there are functions to get that, for the latter you can use substring.

Also, you marked the job as Server yet posted in the PX forum, which job type is it? That will change the answer as to the function needed.
its in datetime format, its a server job..
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

OK, so here we are in the correct forum now. You should be able to use OConv for this, just the "MM" mask should get you what you want.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

If you're reading a string containing a timestamp, just use substring technique.

Code: Select all

InLink.TheString[6,2]
If you want to remove leading zero, just use this in an arithmetic expression.

Code: Select all

InLink.TheString[6,2] + 0
Since server edition does not have an internal timestamp representation that's all the discussion there needs to be.

Oconv() is not your friend here.
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