Thread: Dates
Hi Folks
I have a column for date which defaults to the ambigous 2005-1-1 format.
The documantation indicates how to change this to the unambigous Jan 1 2005, but the instructions aren't clear to me.
Any help will be appreciated.
Bob Pawley
On Wed, 2006-01-18 at 12:00, Bob Pawley wrote: > Hi Folks > > I have a column for date which defaults to the ambigous 2005-1-1 > format. > > The documantation indicates how to change this to the unambigous Jan 1 > 2005, but the instructions aren't clear to me. Actually, if the year comes first, it is not ambiguous. It will always be month-day if the year comes first. It's the mm/dd/yyyy or dd/mm/yyyy that is the issue.
Perhaps you have a solution?? Bob ----- Original Message ----- From: "Scott Marlowe" <smarlowe@g2switchworks.com> To: "Bob Pawley" <rjpawley@shaw.ca> Cc: "Postgresql" <pgsql-general@postgresql.org> Sent: Wednesday, January 18, 2006 10:03 AM Subject: Re: [GENERAL] Dates > On Wed, 2006-01-18 at 12:00, Bob Pawley wrote: >> Hi Folks >> >> I have a column for date which defaults to the ambigous 2005-1-1 >> format. >> >> The documantation indicates how to change this to the unambigous Jan 1 >> 2005, but the instructions aren't clear to me. > > Actually, if the year comes first, it is not ambiguous. It will always > be month-day if the year comes first. It's the > > mm/dd/yyyy or dd/mm/yyyy that is the issue. > > ---------------------------(end of broadcast)--------------------------- > TIP 9: In versions below 8.0, the planner will ignore your desire to > choose an index scan if your joining column's datatypes do not > match
Oh yeah, right. You want to set your datestyle. See: Changing it once: http://www.postgresql.org/docs/8.1/static/datetime-appendix.html Changing it for a database: http://www.postgresql.org/docs/8.1/static/sql-alterdatabase.html Changing it for everything that doesn't override it: http://www.postgresql.org/docs/8.0/static/runtime-config.html On Wed, 2006-01-18 at 12:17, Bob Pawley wrote: > Perhaps you have a solution?? > > Bob > > ----- Original Message ----- > From: "Scott Marlowe" <smarlowe@g2switchworks.com> > To: "Bob Pawley" <rjpawley@shaw.ca> > Cc: "Postgresql" <pgsql-general@postgresql.org> > Sent: Wednesday, January 18, 2006 10:03 AM > Subject: Re: [GENERAL] Dates > > > > On Wed, 2006-01-18 at 12:00, Bob Pawley wrote: > >> Hi Folks > >> > >> I have a column for date which defaults to the ambigous 2005-1-1 > >> format. > >> > >> The documantation indicates how to change this to the unambigous Jan 1 > >> 2005, but the instructions aren't clear to me. > > > > Actually, if the year comes first, it is not ambiguous. It will always > > be month-day if the year comes first. It's the > > > > mm/dd/yyyy or dd/mm/yyyy that is the issue. > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 9: In versions below 8.0, the planner will ignore your desire to > > choose an index scan if your joining column's datatypes do not > > match > > ---------------------------(end of broadcast)--------------------------- > TIP 1: if posting/reading through Usenet, please send an appropriate > subscribe-nomail command to majordomo@postgresql.org so that your > message can get through to the mailing list cleanly