AppleScript:获取爱尔兰当前的财政季度

AppleScript : get the current fiscal quarter for Ireland

我需要将爱尔兰的当前季度设置为 AppleScript 的变量。 我不知道如何着手生成这个季度。

有什么想法吗?

干杯

-- January / February / March = 1Q
-- April / May / June = 2Q
-- July / August / September = 3Q
-- October / November / December = 4Q

你是说

set currentMonth to month of (current date) as integer
set currentQuarter to (((currentMonth - 1) div 3 + 1) as text) & "Q"

编辑:或包含设置时区的 AppleScriptObjC 版本

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"