• 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: NSDateFormatter question...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSDateFormatter question...


  • Subject: Re: NSDateFormatter question...
  • From: Ricky Sharp <email@hidden>
  • Date: Wed, 14 Sep 2005 21:02:30 -0500


On Sep 14, 2005, at 3:29 PM, Alec Carlson wrote:

Can anyone explain to me why “today” ends at 12:00 noon instead of 23:59:59
when the following code is executed:


    NSDateFormatter   * theFormatter = [[NSDateFormatter alloc]
initWithDateFormat:@"%c" allowNaturalLanguage:YES];
    NSDate                 * nsDate = [theFormatter
dateFromString:@"today"];
    NSLog(@"%@", nsDate);

This creates a date/time of: 2005-09-14 12:00:00 –0500 instead of:
2005-09-14 23:59:59 –0500 or 2005-09-14 11:59:59 PM –0500. Seems weird that
“today” would not translate to the whole day – including the PM part of the
day...

Considering that the date object only represents a discrete point in time, to me it makes sense that a date of "today" would set the time data to be the midpoint of that day.


If you really need the beginning or end time of the day, there are ways to obtain that.

___________________________________________________________
Ricky A. Sharp         mailto:email@hidden
Instant Interactive(tm)   http://www.instantinteractive.com

_______________________________________________
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


  • Follow-Ups:
    • Re: NSDateFormatter question...
      • From: Alec Carlson <email@hidden>
References: 
 >NSDateFormatter question... (From: Alec Carlson <email@hidden>)

  • Prev by Date: Re: Core data model - binding question
  • Next by Date: Bug? - Binding NSComboBox Enabled
  • Previous by thread: NSDateFormatter question...
  • Next by thread: Re: NSDateFormatter question...
  • Index(es):
    • Date
    • Thread