How to minus one day from a give timestamp data

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
prams
Participant
Posts: 73
Joined: Mon Apr 02, 2007 11:26 pm

How to minus one day from a give timestamp data

Post by prams »

Hi All,
i have a requirement like

i need to subtract one day from given time stamp

how to do in trnsformer, can any one help me in this regard

Thanks & Regards
Prams
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Investigate the use of the DaysFromDateSince function, both by searching here and by reading the documentation.
-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 »

Probably DateFromDaysSince() would be more appropriate.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Whoops, that was what I meant but not what came out of my fingers. :oops:

Damn fingers.
-craig

"You can never have too many knives" -- Logan Nine Fingers
prams
Participant
Posts: 73
Joined: Mon Apr 02, 2007 11:26 pm

Post by prams »

Thanks for the input,

by using DateFromDaysSince()
i am able to get the date which is required but i need the time stamp also,

is there any option to to get timestamp also

input is timestamp and out put is also timestamp.

but now i am getting like
input is timestamp and output is date format.

thanks for the valueable input

Thanks & Regards
Prams
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Data format? Does the timestamp need to be converted? If not, simply cat it back on the end of the converted date.
-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 »

You will need to decompose your input timestamp into date and time components, adjust the date component, then reassemble. You do not have to convert to string (which is what Craig suggests) - there are functions such as TimestampToDate() that you can use.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
prams
Participant
Posts: 73
Joined: Mon Apr 02, 2007 11:26 pm

Post by prams »

Thank you chulett and ray.wurlod for your valueable input.

its working

Thanks & Regards
Prams
fmcmullan
Premium Member
Premium Member
Posts: 8
Joined: Thu Sep 29, 2005 9:19 am

Post by fmcmullan »

I have used TimestampFromSecondsSince(-86400, X) to do this without having to deconstruct/reconstruct anything. It has worked well for me.
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Beware that 2008-12-31 has 86401 seconds!
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