Home » RDBMS Server » Server Administration » date datatype drive me crazYYY
date datatype drive me crazYYY [message #371123] Fri, 01 September 2000 06:35 Go to next message
Eric Sato
Messages: 1
Registered: September 2000
Junior Member
hi all,
how to add and set time in my record?
eg
field1
------
2000-12-23 07:07:23
.
.
.
i wanna set all the records in field1 with remain the date but the time to 04:00:00?

how to add the time in field1 (all records) ??
such as 2000-12-23 07:07:23 + 3 hours
how ??
pls help me out
best regards
Eric sato
Re: date datatype drive me crazYYY [message #371128 is a reply to message #371123] Fri, 01 September 2000 09:48 Go to previous message
John R
Messages: 156
Registered: March 2000
Senior Member
To set the time component to 4:00 (for example) try:

UPDATE table
SET field = TO_DATE(TO_CHAR(field,'dd-mon-yyyy')||' 04:00', 'dd-mon-yyyy hh24:mi');

You could adapt this to set the time component to be the current time plus 4 hours by using

UPDATE table
SET field = field+(4/24);

Hope this helps

John
Previous Topic: Returning REF CURSORS of Oracle Stored Procedures
Next Topic: How to call userdefined func from a sql
Goto Forum:
  


Current Time: Fri Mar 29 05:07:10 CDT 2024