I tried multiple options but i want to know if there is a simpler way to get the dates from a week number.
Ex: Week 18
Start date from current week TO_CHAR(TRUNC(CURRENT_DATE, 'IW'),'DD.MM.YYYY')
End date from current ween TO_CHAR(NEXT_DAY(TRUNC(CURRENT_DATE,'IW'),'SUNDAY'),'DD.MM.YYYY')
This will return 30.04.2018
and 06.05.2018
But is there a simpler way to get start and end for week 19 for example ?
Thanks in advance!
It is unclear to me why you need to convert from a date to a string. I would simply use:
TRUNC(CURRENT_DATE, 'IW') as date_start
TRUNC(CURRENT_DATE, 'IW') + 6 as date_end
You can, of course, use TO_CHAR()
to get any output format you want.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.