dbTalk Databases Forums  

How to update time in a date column in oracle

comp.databases comp.databases


Discuss How to update time in a date column in oracle in the comp.databases forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
pankyrai
 
Posts: n/a

Default How to update time in a date column in oracle - 07-18-2006 , 02:57 AM






Hi

I have a date column in one of the table in oracle. The date value
stored is:
7/5/2006 2:11:00 PM.

I would like time to be updated to 6PM so that the date value will look
like:
7/5/2006 6:00:00 PM.

Can anybody please help.

Thanks
Pankaj


Reply With Quote
  #2  
Old   
Lennart
 
Posts: n/a

Default Re: How to update time in a date column in oracle - 07-18-2006 , 03:40 AM







pankyrai wrote:
Quote:
Hi

I have a date column in one of the table in oracle. The date value
stored is:
7/5/2006 2:11:00 PM.

I would like time to be updated to 6PM so that the date value will look
like:
7/5/2006 6:00:00 PM.

Can anybody please help.

What have you tried so far, and what error message did you get?


/Lennart



Reply With Quote
  #3  
Old   
pankyrai
 
Posts: n/a

Default Re: How to update time in a date column in oracle - 07-18-2006 , 04:43 AM



Hi
I have tried this option:
1. Truncated the date to remove the timestamp value
2. Concatanated the timestamp value 6:00:00 PM and updated the column

This doesnt works as it updates in incorrect format.
Pankaj


Lennart wrote:
Quote:
pankyrai wrote:
Hi

I have a date column in one of the table in oracle. The date value
stored is:
7/5/2006 2:11:00 PM.

I would like time to be updated to 6PM so that the date value will look
like:
7/5/2006 6:00:00 PM.

Can anybody please help.


What have you tried so far, and what error message did you get?


/Lennart


Reply With Quote
  #4  
Old   
Michael Zedeler
 
Posts: n/a

Default Re: How to update time in a date column in oracle - 07-18-2006 , 05:05 PM



pankyrai wrote:

Quote:
I have tried this option:
1. Truncated the date to remove the timestamp value
2. Concatanated the timestamp value 6:00:00 PM and updated the column
A quick fix would be to convert to string containing only the date using
TO_CHAR with the right format, then appending the string "6:00:00 PM"
and finally converting back to date again.

TO_CHAR is in the manual:

http://kortlink.dk/2uz4

I am sure there is a function for converting from string to date.

It's a hack, but it may just work. Otherwise take a closer look at the
date arithmetic functions:

http://kortlink.dk/2uz5

Regards,

Michael.
--
Which is more dangerous? TV guided missiles or TV guided families?
I am less likely to answer usenet postings by anonymous authors.
Visit my home page at http://michael.zedeler.dk/


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.