2016-04-09 18 views
0

アイルランドの現在の四半期をAppleScriptの変数として設定する必要があります。 私はこの四半期を生み出すためにどのように手続きをとるべきか手がかりがありません。AppleScript:アイルランドの現在の会計年度を取得

歓声

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

の設定などAppleScriptObjCバージョンをヨーロッパ/ダブリンの日付+ '%m''は月の数字を与え、次にモジュラス3を割り、1を加えます。 –

答えて

1

あなたは

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

編集意味するか:あなたは `TZ =」のようなシェルコマンドを実行する可能性や時間帯

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" 
+0

どうしますか?タイムゾーンをアイルランドに設定してください。 –

+0

Brillant、ありがとうございました(アイルランド) –

+0

@MarkSetchellタイムゾーンを設定するASOCバージョンを追加しました – vadian

関連する問題