Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Date Functions

Status
Not open for further replies.

SilverStray

Programmer
Oct 25, 2001
47
AU
How can I get the month of a certain date field in Oracle?
How can I get the current week number for a certain year?
How can I also get the day of the current week?

Please help!

Thanks in advance...

 
Use TO_char() function , to get mont , day and year
for example :
select to_char(sysdate,'MM') from dual;
return month in number
select to_char(sysdate,'Month') from dual;
return month in Word
select to_char(sysdate,'yyyy') from dual;
return Year or date
select to_char(sysdate,'dd') from dual;
return Day of month.


 
To get the week...use the same format...

select to_char ( sysdate, 'ww' ) from dual

This will give you the week number (34) of the current year.

As for the day of the week....

select to_char ( sysdate, 'day' ) from dual

This will return the actual day (Monday)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top