Dear SQLers,
A small question about time presentation using a integer data type. I juesed INTEGER FORMAT '99:99:99' to show time.
below in steps my chalance :-)
SELECT CAST( 110025 AS INTEGER FORMAT '99:99:99') AS VALUE1; /* WAARDE1 1 11:00:25 */ SELECT CAST( 111033 AS INTEGER FORMAT '99:99:99') AS VALUE2; /* WAARDE2 1 11:10:33 */ SELECT CAST( 111033 AS INTEGER FORMAT '99:99:99') - CAST( 110025 AS INTEGER FORMAT '99:99:99') AS VALUE3; /* WAARDE3 1 1008 --<<-- value not presentation in time, I expected; 00:10:08 */ /* My solution do an extra cast */ SELECT CAST( ( CAST( 111033 AS INTEGER FORMAT '99:99:99')- CAST( 110025 AS INTEGER FORMAT '99:99:99') ) AS INTEGER FORMAT '99:99:99') AS VALUE4; /* WAARDE4 1 00:10:08 --<<-- OK ! */ /* I made a type mistake in my query and deduced the future time form the start time. I expected a minus time; -00:10:08 but I was surprised by the result; 46.06:18:08 */ SELECT CAST( ( CAST( 110025 AS INTEGER FORMAT '99:99:99')- CAST( 111033 AS INTEGER FORMAT '99:99:99') ) AS INTEGER FORMAT '99:99:99') AS VALUE4; /* VALUE4 1 46.06:18:08 --<<-- ??? I expected; -00:10:08 */
Whom can help me explain the ‘46.06:18:08’ time.
Forums: