How to compare Two Timestamps

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
Devendrudu
Participant
Posts: 31
Joined: Tue May 24, 2011 12:16 am

How to compare Two Timestamps

Post by Devendrudu »

Hi

I Have source contain two fields current time(timestamp) and previous time(timestamp)

my target field Differ_Time(Time)


example:
Input
previous time,current time
2005-04-25 17:25:43,2005-04-25 18:25:43

Output:
Differ_Time
1:00:00

what function i have to use in Transformer for this .

please help me.
Devendra,Bangalore,India
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Start with SecondsSinceFromTimestamp().
-craig

"You can never have too many knives" -- Logan Nine Fingers
BI-RMA
Premium Member
Premium Member
Posts: 463
Joined: Sun Nov 01, 2009 3:55 pm
Location: Hamburg

Re: How to compare Two Timestamps

Post by BI-RMA »

Hi Devendrudu,

Use SecondsSinceFromTimestamp (Returns the number of seconds between two timestamps). You will, of course, have to reconvert the numeric value to a time-datatype.
"It is not the lucky ones are grateful.
There are the grateful those are happy." Francis Bacon
Devendrudu
Participant
Posts: 31
Joined: Tue May 24, 2011 12:16 am

Re: How to compare Two Timestamps

Post by Devendrudu »

Hi BI-RMA,

thanks your suggestion but i am getting negative integer values but i want correct Time format in output.
Devendra,Bangalore,India
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

It sounds like you've got your timestamps backwards. Look for other functions to convert the result to a time, they are all documented so you shouldn't really need someone else to look them up for you.
-craig

"You can never have too many knives" -- Logan Nine Fingers
Devendrudu
Participant
Posts: 31
Joined: Tue May 24, 2011 12:16 am

Post by Devendrudu »

Hi,


Thanks to all for giving valuable information.

yes i got exact result what i expected by using

SecondsSinceFromTimestamp and TimeFromMidnightSeconds

once again thanks to chulett, and BI-RMA
Devendra,Bangalore,India
Post Reply