In QGIS, how to group the days of a year every 15 days? I have a column with date values throughout 2018, I would like to create a new column identifying which group that date is in

1 Answer 1


I suppose your date value is in your_date column.

floor(day(age("your_date", '2018-01-01')) / 15)

The expression above gives 0 for the first 15 days, 1 from 16th to 30th days, ...

Thee age function calculates an interval between the to dates, the day function extracts the number of days from the interval, the floor function returns the nearest smaller integer value of the division.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.