Page 1 of 1
Convert HH.MM.SS to Seconds
Posted:
Sat Dec 10, 2011 2:21 am
by coldplay1991
Does anyone know how to convert HH.MM.SS to seconds.
I want to covert HH.MM.SS to Seconds using DB2 on z/OS.
Then I want to ensure that those two values are within plus or minus of 30 seconds.
How will I do that?
Re: Convert HH.MM.SS to Seconds
Posted:
Sat Dec 10, 2011 3:12 am
by Akatsukami
coldplay1991 wrote:Does anyone know how to convert HH.MM.SS to seconds.
I want to covert HH.MM.SS to Seconds using DB2 on z/OS.
Then I want to ensure that those two values are within plus or minus of 30 seconds.
How will I do that?
Probably by using
MIDNIGHT_SECONDS.
Re: Convert HH.MM.SS to Seconds
Posted:
Tue Dec 27, 2011 10:29 am
by AnandB
TIMESTAMPDIFF could be one alternative
SELECT
TIMESTAMPDIFF(02, CHAR(TIMESTAMP('1997-02-01-01.03.30')
- TIMESTAMP('1997-02-01-01.02.00'))) will give us a integer value of 90.
Re: Convert HH.MM.SS to Seconds
Posted:
Tue Dec 27, 2011 2:37 pm
by Nik22Dec
Yes..MIDNIGHT_SECONDS can definitely do that. A sample SQL would look like -
SELECT MIDNIGHT_SECONDS('12.12.12') FROM DB2.DUMMY;
Thanks & Regards,
Nik