Hi,
I am trying to extract the weeknumber from a date. But both my SQL statements return the wrong weeknumber. Here is my first statement:
SELECT to_char(to_date(cf$_co_date_order, 'dd-mm-yyyy'), 'ww') FROM customer_order_cfv
Statement returns:
| 22-3-2021 0:00 | 12 |
| 23-3-2021 0:00 | 12 |
| 24-3-2021 0:00 | 12 |
| 24-3-2021 0:00 | 12 |
| 25-3-2021 0:00 | 12 |
| 26-3-2021 0:00 | 13 |
| 26-3-2021 0:00 | 13 |
| 26-3-2021 0:00 | 13 |
| 26-3-2021 0:00 | 13 |
My second statement:
SELECT to_char(to_date(cf$_co_date_order, 'dd-mm-yyyy'), 'iw') FROM customer_order_cfv
Statement returns:
| 22-3-2021 0:00 | 12 |
| 23-3-2021 0:00 | 12 |
| 24-3-2021 0:00 | 13 |
| 24-3-2021 0:00 | 13 |
| 25-3-2021 0:00 | 13 |
| 26-3-2021 0:00 | 13 |
| 26-3-2021 0:00 | 13 |
| 26-3-2021 0:00 | 13 |
| 26-3-2021 0:00 | 13 |
So both are wrong. I expect every date to return weeknumber 12, because that is the correct weeknumber. Does someone know how to achieve this?