カテゴリー: timezone

Get the ISO 3166 country code from Time Zone

–> contryAndLocationKit.framework

AppleScript名:Get the ISO 3166 country code from Time Zone
— Created 2016年04月10日 by Takaaki Naganoya
— 2016 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use framework "contryAndLocationKit" –iospirit/NSTimeZone-ISCLLocation & BigZaphod/CLLocation-SunriseSunset
–https://github.com/iospirit/NSTimeZone-ISCLLocation
–https://github.com/BigZaphod/CLLocation-SunriseSunset

set aTZ to (current application’s NSTimeZone’s localTimeZone())’s |description|() as string
–>"Local Time Zone (Asia/Tokyo (JST) offset 32400)"

set aCountry to ((current application’s NSTimeZone’s localTimeZone())’s ISO3166CountryCode()) as list of string or string
–> "JP"
–> missing value (error)

asoc_現在のLocateのカレンダーの最初の曜日を取得する v2

AppleScript名:asoc_現在のLocateのカレンダーの最初の曜日を取得する v2
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"
use bPlus : script "BridgePlus" –https://www.macosxautomation.com/applescript/apps/BridgePlus.htmkl

set aCalendar to current application’s NSCalendar’s currentCalendar()
set aFirstDay to (aCalendar’s firstWeekday)
set c to (current application’s SMSForder’s fordIn:aFirstDay) as integer
–> 1 (Sunday Start Calendar)

–フランス、香港は月曜日がカレンダーの先頭に来るため結果が異なる
–> 2 (Monday Start Calendar)

asoc_現在のLocaleのカレンダーのTime Zoneを取得する

AppleScript名:asoc_現在のLocaleのカレンダーのTime Zoneを取得する
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set aCalendar to current application’s NSCalendar’s currentCalendar()
set aTimeZone to (aCalendar’s timeZone)
set tzName to aTimeZone’s |name|() as string
–> "Asia/Tokyo"

set tDiff to (aTimeZone’s secondsFromGMT()) / 3600
–> 9.0

set aDesc to aTimeZone’s |description|() as string
–> "Asia/Tokyo (JST) offset 32400"

asoc_OSが使用しているtimezoneを取得する

AppleScript名:asoc_OSが使用しているtimezoneを取得する
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set aTZ to current application’s NSTimeZone
set sysZone to aTZ’s systemTimeZone()
set tzName to sysZone’s |name|() as string
–> "Asia/Tokyo"

TimeZone名を現在のlocaleの言語で返す

AppleScript名:TimeZone名を現在のlocaleの言語で返す
— Created 2018年01月17日 16:57:25 +0900 by Takaaki Naganoya
— 2018 Piyomaru Software
use AppleScript version "2.4"
use scripting additions
use framework "Foundation"

set aTZ to current application’s NSTimeZone’s localTimeZone()
set tzName to aTZ’s localizedName:(current application’s NSTimeZoneNameStyleStandard) locale:(current application’s NSLocale’s currentLocale())

return tzName as string
–> "日本標準時"