Quote:
|
Originally Posted by tachek
I'm trying to calculate the amount of minutes between two datetime variables. I want the final result to be an integer, but I don't know the syntax to use in Informix.
Any help is appreciated.
|
I've never known how to convert an interval to an integer directly... however, this is the way I managed to do it:
define dt1 datetime year to second;
define dt2 datetime year to second;
define iv1 interval minute(9) to minute;
define number1 integer;
let dt1 and dt2 get whatever values are needed;
let iv1 = dt1 - dt2;
let number1 = iv1::char(10);
variable number1 gets the number of minutes passed between dt2 and dt1, which I assume you will like to use in some math expressions afterwards (if not, you could stick to the interval-type variable!)
hope this helps
