Skip to content
Advertisement

Select a specific time in DB2 from the currenttime

I am trying to do a select and set the time to 10AM in DB2. Ive tried

SELECT (trunc(sysdate) + 10/24) FROM sysibm.sysdummy1;

however this sets the time to 0:00:00, im trying to get it set to 10AM, is there a way to do this in DB2?

Advertisement

Answer

Please can you try this:

SELECT trunc(sysdate) + 10 hours FROM sysibm.sysdummy1;

Here is the DEMO

Also, in your question example you have one open bracket too many. it should be: SELECT (trunc(sysdate) + 10/24) FROM sysibm.sysdummy1

Cheers!

User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement