• 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: Need localization-proof method of transporting dates.
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Need localization-proof method of transporting dates.


  • Subject: Re: Need localization-proof method of transporting dates.
  • From: Michael Ash <email@hidden>
  • Date: Wed, 8 Apr 2009 00:31:53 -0400

On Wed, Apr 8, 2009 at 12:11 AM, Graham Cox <email@hidden> wrote:
> Well, the date itself is stored in the archive using standard archiving. I'm
> not sure how it writes itself - so should I be worried? I thought I could
> rely on archiving/dearchiving accurately giving me back whatever I stored
> though in this case there could be a tiny change.
>
> The date comes from a NSDatePicker control, which is set to have 1 minute
> resolution (which is still more than I need, 1 day res would be fine,
> haven't looked into whether there's a way to lose the time part in the
> control). I can certainly pre-process the received date to truncate it to a
> whole minute or even a whole day. I should probably do this to make sure.

I got curious and experimented. Archiving (as in NSCoder) appears to
work fine, but if you send an NSDate through an XML plist, it loses
its fractional seconds! (rdar://6768646) So if you're using plist
serialization, you may well not get the same date out that you put in.

However, since it sounds like you'll always get a whole number of
seconds (a multiple of 60, for that matter) then you should be fine.
Explicitly rounding on your side of things certainly wouldn't hurt
either.

Mike
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Need localization-proof method of transporting dates.
      • From: Graham Cox <email@hidden>
References: 
 >Need localization-proof method of transporting dates. (From: Graham Cox <email@hidden>)
 >Re: Need localization-proof method of transporting dates. (From: Christopher Kane <email@hidden>)
 >Re: Need localization-proof method of transporting dates. (From: Graham Cox <email@hidden>)
 >Re: Need localization-proof method of transporting dates. (From: Michael Ash <email@hidden>)
 >Re: Need localization-proof method of transporting dates. (From: Graham Cox <email@hidden>)

  • Prev by Date: Re: Need localization-proof method of transporting dates.
  • Next by Date: Re: SQLite and Unicode
  • Previous by thread: Re: Need localization-proof method of transporting dates.
  • Next by thread: Re: Need localization-proof method of transporting dates.
  • Index(es):
    • Date
    • Thread