Re: [SQL] TO_CHAR or TO_DATE

From: Clark Evans <clark(dot)evans(at)manhattanproject(dot)com>
To: chairudin(at)prima(dot)net(dot)id
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] TO_CHAR or TO_DATE
Date: 1999-03-31 14:27:33
Message-ID: 370230D5.DA694942@manhattanproject.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Chairudin Sentosa wrote:
> How to do it the right way to insert only month and year?

You don't, it is necessary to have a day as well. Use
the first of the month, and ignore the day in your program.
Thus, insert into table values ( '1-MAR-1999' );

Alternatively, you could create your own type and work out
all the semantics necessary to only manage months. This sounds
interesting actually, only I would do 'week' rather than month.

Clark

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message ZioBudda 1999-03-31 14:46:39 error -dl-
Previous Message miannaco 1999-03-31 14:03:19 merging date and time