> > By formatting the dates as YYYYMMDD and keeping them in strings you can use > simple string comparison to sort, compare and filter. They are also very > easy to format for display purposes. If you want to go standard then use the > ISO 8601 date format. It's YYYY-MM-DD. See > http://www.iso.org/iso/date_and_time_format >
Great, but do not forget, in this case, to store time zone information too, perhaps in a separate string. Time offset won't do because it may change for the same time zone depending on daylight savings time. If I store date as a string, I also store the associated time zone's "name" property. NSDate is more than a plain date. It has time zone info embedded. Just try printing the same date object on daylight savings time date and not, and you will see the date object automatically adjusts the time. So, hypothetically if you stored 2009-12-31 as a string. Then created NSDate object from that string. It may later be interpreted as 2009-12-31 00:00:00 or, let's say 2009-12-30 23:00:00 or 2009-12-31 05:00:00, if the time zone of your user computer changes. Think, what if you user saves an appointment at 12:00:00 in New York and you store it as a string with no time zone info? In Chicago, that appointment will appear at 12:00:00 also even though it is really happening at 11:00:00. Peace. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com