Home » RDBMS Server » Server Administration » Date function - add time
Date function - add time [message #371353] Fri, 06 October 2000 03:56 Go to next message
beomeun kim
Messages: 3
Registered: October 2000
Junior Member
Hi,
i have two questions.

can i insert time except date?
for example '00:13' ( means hour24:minute)

and i want to add only time.
for examdple '00:13' + '02:30' + '12:03'...
how can do i this?

Thanks in advance.
Re: Date function - add time [message #371354 is a reply to message #371353] Fri, 06 October 2000 04:01 Go to previous messageGo to next message
LB
Messages: 13
Registered: September 2000
Junior Member
Try using to_date(field, 'HH24:MI:SS')
This will leave out the date part
Re: Date function - add time [message #371366 is a reply to message #371354] Sat, 07 October 2000 03:26 Go to previous messageGo to next message
beomeun kim
Messages: 3
Registered: October 2000
Junior Member
Hello,

i inserted date field using "to_date";

% insert into test values (date1, to_date('10:33:00', 'hh24:mi:ss'));

but not leaves out the date part.
current date is automatically inserted together.

also i trying this.

% alter table test modify date1 (to_date(date1, 'hh24:mi:ss'));

And trying to create table using "to_date"

but failed...

please explain to me how to do

Thanks.
Re: Date function - add time [message #371372 is a reply to message #371354] Tue, 10 October 2000 05:57 Go to previous message
John R
Messages: 156
Registered: March 2000
Senior Member
In Oracle, there is no such thing as a Time data type.
What you have is a Date-Time datatype instead.
If the time is all you are interested in, just set the date to something like '1-Jan-1900' and store it as a Date.

Alternatively you could store the time as a Number holding the no. seconds after midnight and write your own functions to turn this back into hours, minutes etc.
Or you could store it as 3 seperate fields for hours, minutes,seconds
Or......
Previous Topic: setting nls_date_format in SQL PLUS
Next Topic: Creating Oracle Triggers
Goto Forum:
  


Current Time: Tue Apr 16 15:03:27 CDT 2024