AppleScript名:パラメータを指定してdateオブジェクトを作成 |
— Created 2017-09-22 by Takaaki Naganoya — 2017 Piyomaru Software use AppleScript version "2.5" use scripting additions use framework "Foundation" set a to getDateInternational(2012, 2, 28) of me –> date "2012年2月28日火曜日 0:00:00" set b to getDateInternationalYMDhms(2012, 2, 28, 1, 2, 3) of me –> date "2012年2月28日火曜日 1:02:03" –現在のカレンダーで指定年月のdate objectを返す(年、月、日、時、分、秒) on getDateInternationalYMDhms(aYear, aMonth, aDay, anHour, aMinute, aSecond) set theNSCalendar to current application’s NSCalendar’s currentCalendar() set theDate to theNSCalendar’s dateWithEra:1 |year|:aYear |month|:aMonth |day|:aDay hour:anHour minute:aMinute |second|:aSecond nanosecond:0 return theDate as date end getDateInternationalYMDhms –現在のカレンダーで指定年月のdate objectを返す(年、月、日) on getDateInternational(aYear, aMonth, aDay) set theNSCalendar to current application’s NSCalendar’s currentCalendar() set theDate to theNSCalendar’s dateWithEra:1 |year|:aYear |month|:aMonth |day|:aDay hour:0 minute:0 |second|:0 nanosecond:0 return theDate as date end getDateInternational |
More from my site
(Visited 90 times, 1 visits today)