Oracle week calculate
calculate week
SQL> select abs(to_number(to_char(to_date('21-oct-2011','dd-mon-yyyy'), 'WW')) - to_number(to_char(to_date('06-dec-2011','dd-mon-yyyy'),'WW')) ) "No of weeks" from dual ;
No of weeks
-----------
7
SQL> select abs(to_number(to_char(to_date('21-oct-2011','dd-mon-yyyy'), 'WW')) - to_number(to_char(to_date(sysdate,'dd-mon-yyyy'),'WW')) ) "No of weeks"
from dual ;
No of weeks
-----------
7
No comments:
Post a Comment