How to quote date value?

From: "nobody" <nobody(at)nowhere(dot)near(dot)here>
To: pgsql-sql(at)postgresql(dot)org
Subject: How to quote date value?
Date: 2003-11-21 09:39:18
Message-ID: bpkmg7$2aj3$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

What is correct character to quote date values in SELECT. Is is single
quote?

When I do:

SELECT '1/11/2003' AS "InvoiceDate";

the returned value is of unknown type (not a date).

Then I tried:

SELECT 1/11/2003 AS "InvoiceDate";

and the InvoiceDate was set to zero (I guess the engine divided the numbers
in date).

Then I tried:

SELECT 1-11-2003 AS "InvoiceDate";

and the numbers in date value got substracted.

Using PostgreSQL 7.4 and PgAdmin 3.

Any insight is welcome.

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message nobody 2003-11-21 10:53:31 Re: How to quote date value?
Previous Message Tom Lane 2003-11-21 07:13:40 Re: Substrings by Regular Expression