Please help [message #2771] |
Mon, 12 August 2002 13:21 |
Newie
Messages: 5 Registered: November 2001
|
Junior Member |
|
|
I need to add 11 hours onto a column.
Now this column is in the format of DD-MM-YYYY HH:MMM:SS...My problem is adding the 11 hours on but also altering the DD-MM-YYYY with accordance to additional 11 hours for eg it turns over to the next day...is there any possible way of doing this.....
|
|
|
Re: Please help [message #2772 is a reply to message #2771] |
Mon, 12 August 2002 13:46 |
Todd Barry
Messages: 4819 Registered: August 2001
|
Senior Member |
|
|
What is the datatype of this column - date or varchar2? If it is date, the update is very easy. If not, you have made life much harder on yourself.
If date:
update t
set c = c + (11/24);
If varchar2: What is that datetime format? What is MMM? Why 3 Ms? Here is an answer for a valid format (MI instead of MMM):
update t
set c = to_char(to_date(c, 'DD-MM-YYYY HH24:MI:SS') + (11/24), 'DD-MM-YYYY HH24:MI:SS');
|
|
|
Re: Please help [message #2774 is a reply to message #2771] |
Mon, 12 August 2002 15:15 |
Newie
Messages: 5 Registered: November 2001
|
Junior Member |
|
|
Thanks todd I will give that a try
With the format that was a typo, the column is a Date format and I will give your suggestion a try....
I appreciate your help....
|
|
|
Re: Please help [message #2874 is a reply to message #2771] |
Mon, 19 August 2002 08:47 |
Abul Fazal
Messages: 39 Registered: February 2002
|
Member |
|
|
Select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS '),
to_char((SYSDATE + (11/24)), 'DD-MON-YYYY HH24:MI:SS')
from dual
|
|
|