Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.misc -> Re: Oracle date time
A copy of this was sent to saschac_at_my-deja.com
(if that email address didn't require changing)
On Mon, 11 Oct 1999 17:22:38 GMT, you wrote:
>Hello all, I am trying to get out the time part of a date field. I know
>I can do such a thing like [select to_char(lastmodifiedon,'dd-mon-yy
>hh24:mi:ss') from tblobject where id=7957] and that works but I need to
>be able to do this in a stored procedure.
>
>here is a fragment of my pl/sql procedure
>
>It works fine if i remove the to_char part but i need the time
>
>dLastModifiedOn out date
>vtblObject tblObject%ROWTYPE;
>select * into vtblObject from tblObject where id=idxx;
>dLastModifiedOn:=to_char(vtblObject.LastModifiedOn,'dd-mmm-yyyy hh24:mi:
>
>Any suggestions please. I would like the dLastModifiedOn to stay as a
>date.
Just assign:
dLastModifiedOn := vtblObject.LastModifiedOn;
thats it -- the dLastModifiedOn, being a date, will get the DATE and TIME component. Do not to_char the date to assign to another date. Only use to_char when you are getting ready to display a date somewhere (to_char is for formatting -- the date will keep all of the date/time pieces for you)
>
>Many thanks to you all
>
>Sascha Curzon
>Victoria & Albert Museum
>London
>England
>
>
>Sent via Deja.com http://www.deja.com/
>Before you buy.
--
See http://osi.oracle.com/~tkyte/ for my columns 'Digging-in to Oracle8i'...
Current article is "Part I of V, Autonomous Transactions" updated June 21'st
Thomas Kyte tkyte_at_us.oracle.com Oracle Service Industries Reston, VA USA
Opinions are mine and do not necessarily reflect those of Oracle Corporation Received on Mon Oct 11 1999 - 13:13:07 CDT