Home » SQL & PL/SQL » SQL & PL/SQL » adding time to dates
adding time to dates [message #190304] Wed, 30 August 2006 02:28 Go to next message
Messages: 16
Registered: August 2006
Junior Member

i took this code from 'sql faq'
SQL> select sysdate, sysdate+1/24, sysdate +1/1440, sysdate + 1/86400 from dual;

-------------------- -------------------- -------------------- --------------------
03-Jul-2002 08:32:12 03-Jul-2002 09:32:12 03-Jul-2002 08:33:12 03-Jul-2002 08:32:13

but i when i tried the time part is missing, the result is only having the date part, pls any one assist on this.

Re: adding time to dates [message #190305 is a reply to message #190304] Wed, 30 August 2006 02:31 Go to previous messageGo to next message
Messages: 60
Registered: April 2006
Location: Hyderabad

i too get the same result.i'm trying with some other options
Re: adding time to dates [message #190310 is a reply to message #190305] Wed, 30 August 2006 02:55 Go to previous message
Messages: 5933
Registered: June 2006
Location: Sunny North Yorkshire, ho...
Senior Member
The problem is that you are displaying a date with no explicit date format, so your default NLS format is being used, which almost certainly doesn;t include a time element.

Try either:
select to_char(sysdate,'dd-mon-yyyy hh24:mi:ss')
      ,to_char(sysdate+1/24,'dd-mon-yyyy hh24:mi:ss')
      ,to_char(sysdate +1/1440,'dd-mon-yyyy hh24:mi:ss')
      ,to_char(sysdate + 1/86400,'dd-mon-yyyy hh24:mi:ss')
from dual;

ALTER SESSION SET NLS_DATE_FORMAT = 'dd-mon-yyyy hh24:mi:ss';
Previous Topic: ora_sql_txt
Next Topic: Recover more than one row in a function
Goto Forum:

Current Time: Sat Aug 19 13:55:57 CDT 2017

Total time taken to generate the page: 0.07422 seconds