ActiveSupport >= 3 has
Date.parse('2011-02-10').beginning_of_quarter #=> 2011-01-01
Date.parse('2011-02-10').end_of_quarter #=> 2011-03-31
You can manually calculate the quarter index like
(Date.parse('2011-02-10').month / 3.0).ceil #=> 1
Yes, you do actually divide by 3.0
, not 4.0
.
MySQL has
SELECT QUARTER('2011-02-10'); #=> 1
Posted by Henning Koch to makandra dev (2012-06-20 08:54)