Adrian Nier Code

Back to overview

Quartal of date

Last modification: Sunday, May 03, 2009 12:57 pm

Return an integer respresenting the quartal number for the given date.

Required parameters
Parameter 1 (date)
The date for which the quarter should be determined

Function Call

quartal(current date)

Implementation

on quartal(_d)
   set _m to month of _d as integer
   set _q to 1
   repeat with _i from 1 to 12
      if _i = _m then return _q
      if _i is 3 or _i is 6 or _i is 9 then set _q to _q + 1
   end repeat
end quartal