I need to get the current quarter for Ireland set as a variable for an AppleScript. I have no clue how to procede to get this quarter generated.
Any idea?
cheers
-- January / February / March = 1Q
-- April / May / June = 2Q
-- July / August / September = 3Q
-- October / November / December = 4Q
Do you mean
set currentMonth to month of (current date) as integer
set currentQuarter to (((currentMonth - 1) div 3 + 1) as text) & "Q"
Edit: Or the AppleScriptObjC version including setting the time zone
use framework "Foundation"
set currentCalendar to current application's NSCalendar's currentCalendar()
set dublinTimeZone to current application's NSTimeZone's timeZoneWithName:"Europe/Dublin"
set currentCalendar's timeZone to dublinTimeZone
set currentMonth to (currentCalendar's component:(current application's NSCalendarUnitMonth) fromDate:(current application's NSDate's |date|)) as integer
set currentQuarter to (((currentMonth - 1) div 3 + 1) as text) & "Q"