NEWBIE: Date format/timestamp issue ?

From: news(at)gemini-it(dot)postgresql(dot)org, [removetoreply](dot)com(at)postgresql(dot)org (Neil Everton)
To: pgsql-general(at)postgresql(dot)org
Subject: NEWBIE: Date format/timestamp issue ?
Date: 2002-03-07 10:45:49
Message-ID: 3c874335.1704625@news.plus.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,
Hopefully someone can help me without just saying RTFM ;-)

I'm currently developing a system using postgres and PHP.

My development system is running RH7.2 with postgres 7.1.

I'm using C for the actual application and I have a field
called date_received which is declared as 'timestamp'. My problem is
this, when I insert records into the database timestamp seems to have
a mind of it's own. Sometimes it stores the dates dd-mm-yyyy, but
other times it 'seems to' store them as mm-dd-yyyy.

The C command I'm using is
insert into order_header (date_received) values ('dd-mm-yyyy')'

Is there anyway either in postgres or in the C code to force
the date format to be dd-mm-yyyy ?

I've tried hardcoding dates of 31-12-2002 and 12-31-2002 and
postgres just converts them (correctly) as 31st Dec 2002 both times.
Ideally I'd want to force it to fixed dd-mm-yyyy and have the insert
rejected as out of range.

I've done several searches on the web, on this newsgroup and
through a couple of books, but I'm still drawing a blank. ( I'm
probably asking the wrong questions ;-) )

Any help appreciated
Regards
Neil E.
Remove [removetoreply] from email address to mail me direct

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Oliver Elphick 2002-03-07 12:03:11 Re: Have problems with 7.1 -> 7.2 upgrade
Previous Message Jean-Michel POURE 2002-03-07 08:20:59 Re: [GENERAL] ODBC from win2k to postgres on Linux HELL