Re: Time offset for future dates
Re: Time offset for future dates
- Subject: Re: Time offset for future dates
- From: Shane Stanley <email@hidden>
- Date: Tue, 19 Dec 2017 09:45:42 +1100
On 19 Dec 2017, at 1:57 am, Takaaki Naganoya <email@hidden> wrote:
>
> on retISO8601DateTimeString(targDate, timeZoneName)
> set theNSDateFormatter to current application's NSDateFormatter's
> alloc()'s init()
> theNSDateFormatter's setDateFormat:"yyyy-MM-dd'T'HH:mm:ssZZZ"
> theNSDateFormatter's setTimeZone:(current application's NSTimeZone's
> alloc()'s initWithName:timeZoneName)
> return (theNSDateFormatter's stringFromDate:targDate) as text
> end retISO8601DateTimeString
For general use, I would add:
theNSDateFormatter's setLocale:(current application's NSLocale's
localeWithLocaleIdentifier:"en_US_POSIX")
Otherwise the HH hour format can be overridden by local conventions.
--
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>, <latenightsw.com>
_______________________________________________
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