Thread: Date format errors

Date format errors

From
"Craig Elston"
Date:
Hi Guys and Gals

I have been searching the Docs and lists for an explanation for this error
but to no avail. I'm hoping that someone has had the same problem here &
solved it. I can see that many people have had the error but can't seem to
find the Solution.

I am running Postgresql 7.2.1 with Redhat 8.0 on an IBM Netfinity 5500M10.

When trying to insert a date into a table using HTML Forms & PHP, PGAdminII,
WINSql and even psql on the server I get the following error.

    Query failed: ERROR: Bad date external representation
The syntax I am using is bog simple.

     INSERT INTO repairs VALUES
    (nextval('repairs_id_seq'), '$date', '$username', '$item',
'$serialnumber', '$fault', '$company', '$jobcard',     '$datereturned',
'$comments')

However using PGAdminII I am able to insert records using the view data
function and adding.

I have tried setting the DateStyle to ISO/American as well as ISO/European
still no go. I have tried swopping the yyyy/mm/dd around and tried various
methods of typing the date.

Any help would be appreciated.

Thanks


Craig Elston
Systems Specialist

PIC Solutions
P.O. Box 2455, Cape Town 8000, South Africa

Tel:    +27 (0)21 680-6008
Fax:    +27 (0)21 680-6003
Email:    CElston@PICSolutions.com
Web:    www.PICSolutions.com


---

Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.471 / Virus Database: 269 - Release Date: 10/04/03


Find out what's new in International Decision Engines - Visit the May 6 & 8 Showcases


PIC Solutions cannot ensure that the integrity of this communication has
been maintained, or that it is free of errors, computer viruses,
interference or interception. If you are not the authorised recipient of
this mail, please notify us immediately at Info@PICSolutions.com and delete
the original from your system


Re: Date format errors

From
Bruno Wolff III
Date:
On Wed, Apr 23, 2003 at 16:28:27 +0200,
  Craig Elston <CElston@PICsolutions.com> wrote:
>
> When trying to insert a date into a table using HTML Forms & PHP, PGAdminII,
> WINSql and even psql on the server I get the following error.
>
>     Query failed: ERROR: Bad date external representation
> The syntax I am using is bog simple.
>
>      INSERT INTO repairs VALUES
>     (nextval('repairs_id_seq'), '$date', '$username', '$item',
> '$serialnumber', '$fault', '$company', '$jobcard',     '$datereturned',
> '$comments')

What do the values of $date and $datereturned look like?
Note in particular that '' is not a valid date value. You need to use
NULL if you want a null value.


Re: Date format errors

From
nolan@celery.tssi.com
Date:
> What do the values of $date and $datereturned look like?
> Note in particular that '' is not a valid date value. You need to use
> NULL if you want a null value.

The PHP function var_dump is an excellent debugging tool.
--
Mike Nolan