Oracle And Postgres results different

34 Views Asked by At

In case of Oracle the Query

select SYSDATE - TO_DATE('30-12-1899','dd-mm-yyyy') from dual;

is Giving the Output

SYSDATE-TO_DATE('30-12-1899','DD-MM-YYYY')
--------------------------------------------
              44715.4067

In case of EDB/Postgres it is-

this same Query gives

44715 days 09:46:17

which is different Any way to replicate the same O/p in case of Postgres/EDB?

I even Tried the Query

SELECT EXTRACT(day from (SYSDATE - TO_DATE('30-12-1899','dd-mm-yyyy'))) + EXTRACT(EPOCH FROM (SYSDATE - TO_DATE('30-12-1899','dd-mm-yyyy'))::time)*0.00001 as date;

but it is giving wrong ans

     date
-------------------
 44715.35254000000
(1 row)

Any idea how the same O/p can be achieved in EDB/Postgresql?

0

There are 0 best solutions below