Page 1 of 1

difference between two timestamps

Posted: Mon Jan 04, 2010 6:58 pm
by dodda
hello

i want to find out the difference between two time stamps

a:2010-01-04 14:10:13
b:2010-01-04 16:22:44

how can i obtain the difference between these 2 time stamps (b-a) in datastage.what would be the resulting datatype. because i need to convert the difference between the timestamps to varchar and insert the value into database.

Thanks

Posted: Mon Jan 04, 2010 7:55 pm
by Kryt0n
Have a look at the date and time help functions, all the answers you need are there...

Posted: Mon Jan 04, 2010 8:07 pm
by ray.wurlod
The difference can only be seconds. This will be a numeric data type of some kind, which can implicitly be converted to string (VarChar) provided that the string maximum size (precision) is sufficiently large.

Posted: Mon Jan 04, 2010 8:24 pm
by dodda
Hi Ray,

I tried to compute the difference by specifying the difference as Datatype Numeric.i tried with all the datatypes but i am unable to compile the job.

Thanks
ray.wurlod wrote:The difference can only be seconds. This will be a numeric data type of some kind, which can implicitly be converted to string (VarChar) provided that the string maximum size (precision) is sufficiently large.

Posted: Mon Jan 04, 2010 8:49 pm
by dodda
Hi

i used secondssincefromtimestamp function to get the difference

thanks