user1538020
user1538020

Reputation: 675

Need to convert date_part from postgres to oracle

I have a query in the postgres : select date_part('week', CURRENT_DATE) The outcome of this query is 36.

I need to convert the same postgres query into Oracle . How do I do this ? I tried the below query but I am getting an outcome as 5. select to_number(to_char(CURRENT_DATE,'Week'))FROM DUAL

Upvotes: 0

Views: 432

Answers (1)

Rene
Rene

Reputation: 10551

Have a look at the Oracle date formats:

http://docs.oracle.com/cd/B28359_01/server.111/b28286/sql_elements004.htm#i34924

select to_char(current_date,'IW') from dual

Upvotes: 1

Related Questions