Re: NSDateFormatter question...
Re: NSDateFormatter question...
- Subject: Re: NSDateFormatter question...
- From: Alec Carlson <email@hidden>
- Date: Thu, 15 Sep 2005 08:58:55 -0500
Ricky,
The problem is that I have an NSDateFormatter connected to an NSTextEdit
field in a GUI. The date/time the user enters is used to determine what
database records I display. If the user enters ³Today² I expect that :
dateFromString: would return either the current date/time as the best result
for the natural language translation of ³today² or 11:59:59 PM as the whole
time range of today. If I have to parse the text field myself in order to
know the user entered ³today² then what¹s the point of the translation ? As
it is, if the user enters ³today² and it¹s 5:00 PM then they only see
records before 12:00 noon and nothing from noon to 5:00 PM. ³Today² doesn¹t
end at noon well maybe in some parts of the world it does, and in
Cupertino, but not in Texas :)
Alec
on 9/14/05 9:02 PM, Ricky Sharp at email@hidden wrote:
>
> 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
>
>
-----------------------------------------------------------------------
Time is Short, and the Water Rises
-----------------------------------------------------------------------
_______________________________________________
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