4 posts

HIVE – return closest Monday before date

How to return closest Monday date before, when date is given? It is very simple, user next_day and date_add funtions select next_day(date_add(‘YOUR_DATE’,-7),’MONDAY’) Check — first next Monday od selected date select next_day(‘2020-10-21’, ‘MONDAY’); — returns closest Monday date before select next_day(date_add(‘2020-11-15′,-7),’MONDAY’) select next_day(date_add(‘2020-11-16′,-7),’MONDAY’) select next_day(date_add(‘2020-11-17′,-7),’MONDAY’) select next_day(date_add(‘2020-11-18′,-7),’MONDAY’) select next_day(date_add(‘2020-11-19′,-7),’MONDAY’) select […]