Home » SQL & PL/SQL » SQL & PL/SQL » Easier way to change seconds?
Easier way to change seconds? [message #36763] Wed, 19 December 2001 01:01 Go to next message
S
Messages: 27
Registered: December 2001
Junior Member
Is it possible to change (add or subtract) seconds (or minutes)
on a date field -- with some easy function

or only in hard way :

update my_Table
set date_field=
to_date(to_char(date_field,'dd.mm.yyyy hh24:mi:')||
to_char(3),'dd.mm.yyyy hh24:mi:ss')

----------------------------------------------------------------------
Re: Easier way to change seconds? [message #36769 is a reply to message #36763] Wed, 19 December 2001 08:55 Go to previous message
BondS
Messages: 4
Registered: December 2001
Junior Member
Hi!
declare
OneSecond number := 1/24/3600;
OneMinute number := 1/24/60;
DateField date := to_date('19.12.2001 00:00:00', 'dd.mm.yyyy hh24:mi:ss');
begin
dbms_output.put_line('Now: '||to_char(DateField, 'dd.mm.yyyy hh24:mi:ss'));
dbms_output.put_line('Second later: '||to_char(DateField+OneSecond, 'dd.mm.yyyy hh24:mi:ss'));
dbms_output.put_line('Minute later: '||to_char(DateField+OneMinute, 'dd.mm.yyyy hh24:mi:ss'));
end;

BondS
http://www.geocities.com/oranails/

----------------------------------------------------------------------
Previous Topic: stored procedure and truncate
Next Topic: Data from Web page to Oracle DB
Goto Forum:
  


Current Time: Thu Aug 06 09:13:51 CDT 2020