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 -> sql date function

sql date function

From: Norman Dunbar <Norman.Dunbar_at_lfs.co.uk>
Date: Fri, 22 Nov 2002 11:27:23 -0000
Message-ID: <E2F6A70FE45242488C865C3BC1245DA702F63D08@lnewton.leeds.lfs.co.uk>


Try using this :

to_char(to_date('2000-04-07', 'YYYY-MM-DD'), 'IW') which gives '14' as a string !

If you need it as a number, wrap it in to_number() as well.

to_number(to_char(to_date('2000-04-07', 'YYYY-MM-DD'), 'IW')) which gives 14.

If you want the week number within the month (1 to 5) , drop the 'I'.

to_number(to_char(to_date('2000-04-07', 'YYYY-MM-DD'), 'W')) which gives 1.

HTH Regards,
Norman.



Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:Norman.Dunbar_at_LFS.co.uk
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com

-------------------------------------

-----Original Message-----
From: Maros Kollar [mailto:spam_at_k-1.com] Posted At: Friday, November 22, 2002 10:57 AM Posted To: server
Conversation: sql date function
Subject: sql date function

hi,
i need a sql command to convert a date (unix timestamp, or other fomrat like
yyyy-mm-dd) into a weeknum
i'm using oracle 8i

regards
maros Received on Fri Nov 22 2002 - 05:27:23 CST

Original text of this message

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