• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Changing current date format
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Changing current date format


  • Subject: Re: Changing current date format
  • From: Shane Stanley <email@hidden>
  • Date: Tue, 21 Jan 2014 09:14:20 +1100

On 21 Jan 2014, at 7:42 am, Christopher Stone <email@hidden> wrote:

So rather than hardcode the localization string, it would appear that you could feed it to the hander as part of the call - and it would do the right thing.  Yes?

Sure. You could do something like:

on formatDate:theDate usingFormat:formatString andLocale:localeID
if class of theDate is date then set theDate to my makeNSDateFrom:theDate
set theFormatter to current application's NSDateFormatter's new()
if localeID is not missing value then
theFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:localeID) -- set locale
end if
theFormatter's setDateFormat:formatString
set theString to theFormatter's stringFromDate:theDate
return theString as text
end formatDate:usingFormat:andLocale:

Then change the original to:

on formatDate:theDate usingFormat:formatString
return my formatDate:theDate usingFormat:formatString andLocale:(missing value)
end formatDate:usingFormat:


-- 
Shane Stanley <email@hidden>
<www.macosxautomation.com/applescript/apps/>

 _______________________________________________
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

  • Follow-Ups:
    • Re: Changing current date format
      • From: Deivy Petrescu <email@hidden>
References: 
 >Changing current date format (From: JF <email@hidden>)
 >Re: Changing current date format (From: Luther Fuller <email@hidden>)
 >Re: Changing current date format (From: Christopher Stone <email@hidden>)
 >Re: Changing current date format (From: Emmanuel LEVY <email@hidden>)
 >Re: Changing current date format (From: Shane Stanley <email@hidden>)
 >Re: Changing current date format (From: "koenig.yvan" <email@hidden>)
 >Re: Changing current date format (From: Shane Stanley <email@hidden>)
 >Re: Changing current date format (From: Emmanuel LEVY <email@hidden>)
 >Re: Changing current date format (From: Christopher Stone <email@hidden>)

  • Prev by Date: Re: Changing current date format
  • Next by Date: Re: Changing current date format
  • Previous by thread: Re: Changing current date format
  • Next by thread: Re: Changing current date format
  • Index(es):
    • Date
    • Thread