Generate a random date in Oracle with DBMS_RANDOM

You can generate random dates between two dates ,as displayed in the query below .Random Dates are generated between 1-jan-2000 and 31-dec-9999

  SELECT TO_DATE(
              TRUNC(
                   DBMS_RANDOM.VALUE(TO_CHAR(DATE '2000-01-01','J')
                                    ,TO_CHAR(DATE '9999-12-31','J')
                                    )
                    ),'J'
               ) FROM DUAL;

OR you can use

SELECT TO_DATE (
              TRUNC (
                     DBMS_RANDOM.VALUE (2451545, 5373484) 
                    )
                , 'J'
              )
  FROM DUAL

In the above example ,the first value is 01-Jan-2000 and the second value id 31-dec-9999


To generate random date you can use

select to_date('2010-01-01', 'yyyy-mm-dd')+trunc(dbms_random.value(1,1000)) from dual

or for random datetime

select to_date('2010-01-01', 'yyyy-mm-dd')+dbms_random.value(1,1000) from dual