Re: how to handle dates alone
Re: how to handle dates alone
- Subject: Re: how to handle dates alone
- From: Paul Hoadley <email@hidden>
- Date: Sat, 29 Jan 2011 11:05:00 +1030
Hi Ted,
On 29/01/2011, at 5:19 AM, Theodore Petrosky wrote:
> How are people handling dates with no timezone (and no time, just the date alone)? I really want to use the date column type and not care about the time nor zone but I haven't figured out a way.
Here's the first post in a thread I started last August:
http://lists.apple.com/archives/webobjects-dev/2010/Aug/msg00132.html
Late in the thread, Henrique Prange provides a link to a sample project demonstrating how to use the Joda Time LocalDate class as a custom type in an EO model. I have used Henrique's code, largely unmodified, backed by a PostgreSQL DATE column type in a deployed application since then. It works as designed.
> I just got bitten with a timezone problem when shifting my app to a different box. There must be a prescribed and easier way.
There's no prescribed way. In that thread you'll find several other suggestions, some of which people are apparently using quite widely, and with success. My personal preference is for genuine 1-day resolution types in both the database and the code.
As an aside, I gather you're using PostgreSQL from your posts in another thread. If you're using full-blown timestamps elsewhere in your app (or if you choose one of the alternative solutions to your 1-day resolution problem that involves timestamps), be mindful of the "feature" in the PostgreSQL JDBC driver described in this thread:
http://lists.apple.com/archives/webobjects-dev/2010/Dec/msg00058.html
and the workarounds listed here:
http://wiki.objectstyle.org/confluence/display/WO/Project+WONDER-Frameworks-PostgresqlPlugin
in the yellow warning box entitled "JDBC driver adjusts timestamps".
--
Paul.
http://logicsquad.net/
_______________________________________________
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