Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Getting the operator's short date under Panther.



On 12/11/03 4:37 PM, "Paul Berkowitz" <email@hidden> wrote:

> On 12/11/03 3:31 PM, "S. Elliott" <email@hidden> wrote:
>
>> If anyone is having good success getting a correct, workable short date
>> format string under Panther, if you could share your code I'd be most
>> grateful.
>
> This works under both Panther and Jaguar:
>
>
> set standardDefaults to (call method "standardUserDefaults" of class
> "NSUserDefaults")
>
> set shortDateFormat to (call method "objectForKey:" of
> standardDefaults with parameter "NSShortDateFormatString")
>
>
>
> You're right that there's no longer an "NSShortDateFormatString" in
> Panther's GlobalDomain, and that the AppleICUDateFormatStrings are the
> location, _when the user has set a "Custom" short date_ (or any other
> date/time option) in International System Prefs. But if one of the standard
> localizations is taken (US, UK, French,, etc. etc.) then it's built into
> localization defaults rather than specified in Global Domain. It means that
> there's no way to do it in standard AppleScript - nor even in any shell
> script I can find. But Objective-C NSUserDefaults still access all these
> user formats just the same as they always did, so AS Studio can get at them
> too by call method.


Of course there's a simpler way in plain AppleScript in Panther to get the
user's short date format for a specific date:

get short date string of someDate

But that won't work in Jaguar. Also if you want the time, you'll really need
to concatenate the whole time string, including seconds, or come up with a
complicated way for taking account of the fact that some localized time
strings append a word, like the German " Uhr" to the time. And a few
localizations do not use ":" but "." as time separators.




--
Paul Berkowitz
_______________________________________________
applescript-studio mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/applescript-studio
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: Getting the operator's short date under Panther. (From: Paul Berkowitz <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.