Home » RDBMS Server » Server Administration » Re: Help oracle time fomatting is driving me crazy
Re: Help oracle time fomatting is driving me crazy [message #370224] Mon, 08 February 1999 04:58
Sean Miller
Messages: 12
Registered: December 1998
Junior Member
There are many ways to do this, the most reliable would be to simply add the time on as a fraction of a day.

Consider this code...

select to_char(sysdate,'DDMMYY HH24:MI'),
to_char(sysdate+((1/24/60)*&amt), 'DDMMYY HH24:MI')
from dual

As you probably know, the first is printing "now" with hours and minutes. The second prompts for a value and then adds that number of minutes to the current time and prints it as date/time.

As you probably also know, the sysdate+n adds n days to today. All we are doing here is adding a fraction of a day... therefore replace the &x with the number of minutes you wish to add.

This will work until a government decides to change the number of minutes in a day...!

Sean
Previous Topic: Re: Default value
Next Topic: Re: Help oracle time fomatting is driving me crazy
Goto Forum:
  


Current Time: Fri Mar 29 07:28:55 CDT 2024