Page 1 of 1

How to compare Two Timestamps

Posted: Thu Sep 08, 2011 7:33 am
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.

Posted: Thu Sep 08, 2011 7:44 am
by chulett
Start with SecondsSinceFromTimestamp().

Re: How to compare Two Timestamps

Posted: Thu Sep 08, 2011 7:45 am
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.

Re: How to compare Two Timestamps

Posted: Thu Sep 08, 2011 8:49 am
by Devendrudu
Hi BI-RMA,

thanks your suggestion but i am getting negative integer values but i want correct Time format in output.

Posted: Thu Sep 08, 2011 9:06 am
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.

Posted: Thu Sep 08, 2011 10:48 am
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