Skip to Content
0
Former Member
Jan 18, 2012 at 02:56 PM

Custom Function to determine seconds elapsed

39 Views

Hello All! I have a simple custom function created that is supposed to calculate the seconds elapsed between two datetime values. Here is the code and I'm wondering why it is returning 0 for the seconds elapsed. If I change the code to sysdate()-1 then it shows that 86400 seconds have elapsed.

Note, the $JobStartDate is a Datetime data type.

return((sysdate() - to_Date($JobStartDate, 'yyyy.mm.dd hh24:mi:ss'))2460*60);

The variable that gets sent to the functions $JobStartDate parameter is this

$Test = to_date(sysdate(), 'yyyy.mm.dd hh24:mi:ss');

which when sent through the print() function displays as '2012.01.18 7:52:00'

I then sleep() for 5 seconds and call the function

$SecondsElapsed = ElapsedSeconds($Test)

Print() the $SecondsElapsed variable and it displays 0

What am I missing here?