Code Newbie
News     Forums     Search     Members     Sign Up    

My Code Newbie
Username

Password

Articles/Snippets
ASP Classic
ASP.NET
C
C#
C++
HTML / CSS
Java
Javascript
Linux / BSD
Perl
PHP
Python
Ruby
SQL
VB 6
VB.NET

C.N. Friends
  Planet Rome

Link to Us!
Code Newbie
  Code Newbie
    forums
Old 09-18-2008, 07:10 PM   #1 (permalink)
tomycon
Recruit
 
Join Date: Jul 2002
Location: Massachusetts
Posts: 13
tomycon is on a distinguished road
DATE syntax in postgresql

Hello All,

I'm running a postgresql 8 server on a centos 5 system. I've created a table with a couple of fields using the DATE data type. When I try to insert data I get an error "...incorrect syntax for date data type...". The pgsql manuals state a wide variety of date forms are acceptable: Sept 18, 2008, 2008-09-18, 09/18/08 etc.. I've tried all these formats and more and always get an error on the date.

A typical insert statement:
INSERT INTO projects (name, manager, start_date, end_date, status) VALUES ('Mailing', 'ASMITH', '2008-09-09', '2008-09-18', 'Complete');

Any suggestions are apprciated. Thanks!
tomycon is offline   Reply With Quote
Old 09-20-2008, 12:12 PM   #2 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 746
DJMaze is on a distinguished road
ISO8601 format worked fine in my Postgres.

Code:
CREATE TABLE test
(
  t_int integer,
  t_date date
)
WITH (OIDS=FALSE);

INSERT INTO test (t_int, t_date) VALUES (1, '2008-09-09');
INSERT INTO test (t_int, t_date) VALUES (2, '2008-09-18');
__________________

UT: Ultra-kill... God like!
DJMaze is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problems in date DESC after changing format bayruni PHP 7 04-02-2006 08:01 PM
Regarding the date obtained using java.util.Date class j.gohel Java 1 03-29-2006 03:21 PM
Order by greater of two date columns Wysocki Everything SQL ( MySQL, MSSQL, DB2, Postgre, Oracle, etc...) 4 02-07-2005 06:10 PM


All times are GMT -8. The time now is 03:18 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0 RC8 ©2007, Crawlability, Inc.





Copyright © 2000-2008, Milano Interactive
Web Hosting provided by Portal 360 Web Hosting