Question

I am getting lost and nuts with the DATETIME in Informix.I have two problems which I can hardly solve:

  1. I have a DATETIME column (e.g. starttime) which I need to convert into an int value, e.g. seconds of year or epoch, or whatever. I found some conversion into utc, but this depends on the timezone the server runs, which I have no idea how to specify for the conversion.... Any other hint, how to convert it into seconds would be appreciated.
  2. I need to calculate the difference between two DATETIME-fields (e.g. endtime-starttime) and then sum it up. To my understanding the result is interval day(13) to fraction(3). I need to convert the sum once again into seconds, cause I need to update other values with this result.

So, can anybody help me as to how to convert within a SQL-statement the different result-types?

Was it helpful?

Solution

CAST it to INT, example:

select 
((current + 5 units day - current)::interval second(9) to second)
,((current + 5 units day - current)::interval second(9) to second)::char(10)::int8
from systables
where tabid=1
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top