Re: Date-Only NSTimestamps
Re: Date-Only NSTimestamps
- Subject: Re: Date-Only NSTimestamps
- From: Art Isbell <email@hidden>
- Date: Wed, 2 Jan 2008 12:47:18 -1000
On Jan 2, 2008, at 11:25 AM, Pierce T. Wetter III wrote:
I'm A bit of a date/time wonk
I was also until the choice became one of continuing to be a date/
time wonk or descending further into insanity (or maybe "ascending"
would be more appropriate :-)
In your case, you're doing a report, so you have 2 date ranges. So
this then becomes a UI question. Let's say someone wants to do a
query for 2007. In most reporting software, that becomes:
WHERE date >= TIMESTAMP '2007-01-01 00:00:00' and date < TIMESTAMP
'2008-01-01 00:00:00'
that is, to get all of 2007, you really have to put the end date in
as midnight of the first second of 2008.
Definitely!
Which is weird UI, because the dates themselves are:
2007-01-01 to 2007-12-31
I try to finesse this by using "2007-01-01 through 2007-12-31", but
most users don't seem to grok the distinction.
So.... What you can do is basically tweak the inputs. The low date
is rounded _down_ to midnight, the high date is converted to the
_next_ day then rounded down.
where date >= input_low.beginningOfDay() and date <
input_high.nextDay().beginningOfDay()
Yep. This is what we date/time wonks know is the only correct way :-)
Aloha,
Art
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden