Group By Jalali Date in Postgresql I want GROUP BY jalali's month, all date save as gregorian format in my database, I found following sql query but group by gregorian date
SELECT COUNT(reserverow.id), EXTRACT(MONTH FROM reserverow.used_date) as &quot;Month&quot;
FROM reserverow
WHERE reserverow.used_date &gt; '2000-09-28 01:00:00'
GROUP BY EXTRACT(MONTH FROM reserverow.used_date)
The easiest way to do this would be to use Team Appir's jalali_utils extension for PostgreSQL. Then you could write your query like this:
SELECT COUNT(reserverow.id), EXTRACT(MONTH FROM reserverow.used_date) as &quot;Month&quot;
  FROM reserverow
 WHERE reserverow.used_date &gt; '2000-09-28 01:00:00'
 GROUP BY JALALI_PART('month', reserverow.used_date)