×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




A new option is to use the EPOCH support for the EXTRACT function.

values extract(epoch from timestamp(year(current date + 1 year) concat
'-01-01-07.00.00'))
- extract (epoch from current timestamp);

EPOCH
Specifies that the number of seconds since 1970-01-01 00:00:00.00 is
returned
for the date-expression or timestamp-expression. The value can be positive
or
negative.

This was part of the most recent DB PTF Group.
7.3: SF99703 level 12
7.2: SF99702 level 24

Sue Romano
Db2 for IBM i Development


From: "Gerald Magnuson" <gmagqcy.midrange@xxxxxxxxx>
To: "Midrange List" <midrange-l@xxxxxxxxxxxx>
Date: 10/15/2018 12:02 PM
Subject: SQL for delay timer...
Sent by: "MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx>



I need to compute the number of seconds between NOW and the next January
1st, 7am...

I have:
select
TIMESTAMPDIFF(2,CHAR(TS2 - TS1))
from (
SELECT CURRENT TIMESTAMP AS TS1,
TIMESTAMP(CONCAT(
CAST(CHAR(YEAR(CURRENT DATE)+ 1) as CHAR(4)),
CHAR('-01-01-07.00.00')))as TS2
FROM SYSIBM.SYSDUMMY1 ) as data

but that won't work when it's the wee hours of January 1st (after
midnight, before 7am)...





This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2026 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.