Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: date functions

Re: date functions

From: Thomas Kyte <tkyte_at_us.oracle.com>
Date: Mon, 03 Jan 2000 20:37:18 -0500
Message-ID: <kjj27s85b1qrjr6ffk6tcc2vo63qnp5ch3@4ax.com>


A copy of this was sent to steve hendrikse <shendrik_at_ebtech.net> (if that email address didn't require changing) On Mon, 3 Jan 2000 16:52:18 -0500, you wrote:

>hi,
>
>how can i select sections, like the month, day, or year from a date?
>if i do a "select sysdate from dual" then i get the complete date. now i want
>only the month or day? of course, how can i select only a portion of a date
>that is stored in a data column?
>
>thanks in advance,
>steve

see the to_char() function and all of its related formats (tons of them)....

for example:

tkyte_at_8.0> select to_char(sysdate,'mm'), to_char(sysdate,'yyyy'),   2 to_char(sysdate,'Jsp') from dual;

TO TO_C TO_CHAR(SYSDATE,'JSP')

-- ---- --------------------------------------------------------------------
01 2000 Two Million Four Hundred Fifty-One Thousand Five Hundred Forty-Seven

--
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 Jan 03 2000 - 19:37:18 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US