Re: date comparison in EOModeler
Re: date comparison in EOModeler
- Subject: Re: date comparison in EOModeler
- From: "Arturo Perez" <email@hidden>
- Date: Mon, 13 Dec 2004 11:07:15 -0500
In Oracle you can do something like
trunc(timestamp) = trunc(myTimestamp)
I think in postgresql the equivalent would/could be either the above or
timestamp::date = myTimestamp::date
or even
timestamp::date = now()::date.
You could even use SQL92 compliant casting syntax but I can't type that
off the top of my head. There's also an EOF casting syntax that I think
looks something like
(NSDate)timestamp = (NSDate)now().
Nathan Dumar wrote:
As simply as I can explain it ...
Get the current date/time with a new NSTimestamp (for this example, I'll
call it rightNow). Obtain from this the number of hours, minutes, and
seconds (this will be for today only) (make sure you use 24-hour time,
not 12-hour time). Subtract these hours, minutes, and seconds from
rightNow, and you have the midnight of the beginning of today.
Now, when you do your database query, you want all the records whose
timestamp is > (greater than) the time you derived above, which is
midnight of the beginning of today.
If you need more help, let me know.
Take care,
Nathan
On Dec 13, 2004, at 5:33 AM, Goh Keng Boon wrote:
Hi All,
I've a field in my table which is defined as timestamp (postgres), and
i would like to extract out all the data where timestamp is today's date,
what will be the most effective way?
thanks.
Regards,
KB
_______________________________________________
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
_______________________________________________
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