I am using the code below to generate random dates, which works fine.
Can this be modified to add a random time to the date between from 00:00:00 - 23:59:59
My attempt below failed and I'm unsure why. Any help would be greatly appreciated.
ALTER SESSION SET NLS_DATE_FORMAT = 'MMDDYYYY HH24:MI:SS';
SELECT TO_DATE(
TRUNC(
DBMS_RANDOM.VALUE(TO_CHAR(DATE '2021-01-01','J')
,TO_CHAR(DATE '2022-12-31','J')
)
),'J' +
NUMTODSINTERVAL(FLOOR(DBMS_RANDOM.VALUE(0,86399)), 'SECOND')
) FROM DUAL;