我需要将爱尔兰的当前季度设置为 AppleScript 的变量。我不知道如何继续生成这个季度。
任何想法?
干杯
-- January / February / March = 1Q
-- April / May / June = 2Q
-- July / August / September = 3Q
-- October / November / December = 4Q
我需要将爱尔兰的当前季度设置为 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"