• 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: arbitrary date formats based on user prefs
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: arbitrary date formats based on user prefs


  • Subject: Re: arbitrary date formats based on user prefs
  • From: "Sean McBride" <email@hidden>
  • Date: Mon, 27 Dec 2004 01:42:55 -0500

Ben Dougall (email@hidden) on Tue, Dec 21, 2004 6:33 PM said:

>how can i display particular date elements in the style of the user's
>prefs?
>
>eg, say i want to display full day name and day of month number and
>full month name. is there a way to get the user's preferred way of that
>particular set of data?

As others have said, there is no general way to do this. :(

>like, i'd prefer to see it as "Saturday, 25
>December" who's format is "%A, %e %B" but other people probably would
>prefer it "Saturday, December 25" and maybe other ways.

In my app, I have had similar situations.  What I did was start with
NSDateFormatString then parse the string and keep or remove parts I needed.

For example, I wanted to show dates without a year, like: "December 25",
vs "25 December", etc.  NSDateFormatString gives something like: "%A, %e
%B, %Y", I start with the assumption that month and day will be adjacent,
then find them in the string, then chop off all but them.  Even this
seemingly simple thing was tricky, as there are several possibilities for
month (%b, %B, %m, %1m) and day (%e, %d).  If you'd like to see the code,
let me know.

--
____________________________________________________________
Sean McBride, B. Eng                         email@hidden
Mac Software Designer               Montréal, Québec, Canada


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >arbitrary date formats based on user prefs (From: Ben Dougall <email@hidden>)

  • Prev by Date: coordinate transformation
  • Next by Date: Re: NSDecimal localization
  • Previous by thread: Re: arbitrary date formats based on user prefs
  • Next by thread: Examining the Call Stack
  • Index(es):
    • Date
    • Thread