Re: Calculate Current Year Quarter with Time Zone Using AppleScriptObjC
Re: Calculate Current Year Quarter with Time Zone Using AppleScriptObjC
- Subject: Re: Calculate Current Year Quarter with Time Zone Using AppleScriptObjC
- From: Nigel Garvey <email@hidden>
- Date: Sat, 14 Jan 2017 19:22:02 +0000
Deivy Petrescu wrote on Sat, 14 Jan 2017 09:43:22 -0500:
>> On Jan 14, 2017, at 24:17 , Christopher Stone <email@hidden> wrote:
>>
>> use framework "Foundation"
>> -------------------------------------------------------------------------------------------
>>
>> set currentCalendar to current application's NSCalendar's currentCalendar()
>> set theTimeZone to current application's NSTimeZone's
>>timeZoneWithName:"US/Central"
>> set currentCalendar's timeZone to theTimeZone
>> 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"
>>
>
>
>or
>
>return ((((month of (current date)) - 1) div 3 + 1) as string) & " Q”
Hi both.
((currentMonth - 1) div 3 + 1) could be ((currentMonth + 2) div 3)
NG
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden