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
charankarthikeyan
Messages: 16
Registered: August 2006
Junior Member
hi,

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

SYSDATE SYSDATE+1/24 SYSDATE+1/1440 SYSDATE+1/86400
-------------------- -------------------- -------------------- --------------------
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.

karthik
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
sunsanvin
Messages: 60
Registered: April 2006
Location: Hyderabad
Member

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
JRowbottom
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;

or
ALTER SESSION SET NLS_DATE_FORMAT = 'dd-mon-yyyy hh24:mi:ss';
Previous Topic: My very first Insert - Can I get some assistance please:)
Next Topic: Recover more than one row in a function
Goto Forum:
  


Current Time: Sun Dec 04 18:54:57 CST 2016

Total time taken to generate the page: 0.16095 seconds