The MIDNIGHT_SECONDS function returns an integer value that is greater than or equal to 0 and less than or equal to 86 400(R) representing the number of seconds between midnight and the time value specified in the argument.
The result of the function is large integer. If the argument can be null, the result can be null; if the argument is null, the result is the null value.
SELECT MIDNIGHT_SECONDS(:XTIME1), MIDNIGHT_SECONDS(:XTIME2) FROM SYSIBM.SYSDUMMY1This example returns 60 and 47410. Because there are 60 seconds in a minute and 3600 seconds in an hour, 00:01:00 is 60 seconds after midnight ((60 * 1) + 0), and 13:10:10 is 47410 seconds ((3600 * 13) + (60 * 10) + 10).
SELECT MIDNIGHT_SECONDS('24:00:00'), MIDNIGHT_SECONDS('00:00:00') FROM SYSIBM.SYSDUMMY1This example returns 86400 and 0. Although these two values represent the same point in time, different values are returned.
(C) Copyright IBM Corporation 1992, 2006. All Rights Reserved.