Skip site navigation (1) Skip section navigation (2)

Re: formating a select from a timestamp column

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: stig erikson <stigerikson_nospam_(at)yahoo(dot)se>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: formating a select from a timestamp column
Date: 2005-11-23 12:17:16
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-novice
On Sun, Nov 13, 2005 at 11:30:33 +0100,
  stig erikson <stigerikson_nospam_(at)yahoo(dot)se> wrote:
> hi i have a column that is declared as:
> datum timestamp DEFAULT ('now'::text)::timestamp(6) with time zone
> then i do:
> SELECT datum from table;
> and get something like: 2005-11-13 00:00:00
> i would like the output to be on the format: 2005-11-13
> how can i change it?

You could cast it to a date. If these times only represent dates, then you
should probably just store dates instead of timestamps.

> i use postgresql 8.1
> thanks
> stig
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

In response to

pgsql-novice by date

Next:From: Bruno Wolff IIIDate: 2005-11-23 12:23:57
Subject: Re: Ordering output rows by the maximum value of three virtual columns
Previous:From: Jaime CasanovaDate: 2005-11-22 20:26:35
Subject: Re: postgreSQL-8.1-beta4 and C, C++

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group