• 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: Emmanuel LEVY <email@hidden>
  • Date: Mon, 20 Jan 2014 08:37:52 +0100

OK OK I think I'll stay with 20.01.2014...  :-)

Thanks Shane, that's great code.
Emmanuel

On Jan 20, 2014, at 7:57 AM, Shane Stanley wrote:

> On 20 Jan 2014, at 5:15 pm, Emmanuel LEVY <email@hidden> wrote:
>
>> One reason could be that with this old stuff you don't have to know the computer's locale settings.
>>
>> In other words, this kind of line makes a robust localized month:
>>
>> ----
>> word ((get current date)'s month as integer) of "Janvier Février etc." -- here the francophone version
>> ----
>
> FWIW, the handler I posted can accommodate this pretty simply:
>
> on formatDate:theDate usingFormat:formatString
> 	if class of theDate is date then set theDate to my makeNSDateFrom:theDate
> 	set theFormatter to current application's NSDateFormatter's new()
> 	theFormatter's setLocale:(current application's NSLocale's localeWithLocaleIdentifier:"fr") -- extra line to set locale
> 	theFormatter's setDateFormat:formatString
> 	set theString to theFormatter's stringFromDate:theDate
> 	return theString as text
> end formatDate:usingFormat:
>
> Called by:
>
> use theLib : script "<name of lib>"
> use scripting additions
>
> theLib's formatDate:(current date) usingFormat:"ddMMMYY"
> --> "20janv.14"
> theLib's formatDate:((current date) + 12 * days) usingFormat:"dd MMMM YY"
> --> "01 février 14"
>
> --
> 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


 _______________________________________________
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


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>)

  • 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