Search code examples
sqlimpalahue

Find the week of month in Impala


I want to print in impala that 2020-03-01 is in the first week of March. How is this possible in Impala? I managed only to find the weekofyear().


Solution

  • If by "week of month" you mean that the first week is days 1-7, the second 8-14, and so on, then you can use:

    select ceiling( day(ingestion_date) / 7.0 ) as week_of_month