Re: formating a select from a timestamp column

From: Keith Worthington <KeithW(at)NarrowPathInc(dot)com>
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-12-11 02:38:49
Message-ID: 439B9139.6050403@NarrowPathInc.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

stig erikson 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?
>
> i use postgresql 8.1
>
> thanks
> stig
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings
>
>

Stig,

How about just casting it to a date?

SELECT datum::date from table;

--
Kind Regards,
Keith

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Omar Zevallos 2005-12-12 02:51:42 Hi, connecting PostgreSQL 8.1 to GeoServer1.3
Previous Message Mag Gam 2005-12-10 23:30:49 Book Application