Re: How to extract hour and minutes from a timestamp

From: Andrew McMillan <andrew(at)catalyst(dot)net(dot)nz>
To: Tan ga <gndtanga(at)mail(dot)pt>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: How to extract hour and minutes from a timestamp
Date: 2002-10-17 19:34:19
Message-ID: 1034883258.1154.901.camel@kant.mcmillan.net.nz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Fri, 2002-10-18 at 05:52, Tan ga wrote:
> Hi again :)
>
> I already resolver my other problem but now i would like to extract both
> time and hour from a timestamp in order to compare with a string.
> Ex 2000-01-01 19:30:00
> I want the result to be 19:30
>
> With select substr(....) i can do this but that's not what i want.
>
> I'm using python with postgres.

See:
http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/functions-formatting.html

Something like:

to_char( my.timestamp, 'YYYY-MM-DD HH24:MI')

Cheers,
Andrew.
--
---------------------------------------------------------------------
Andrew @ Catalyst .Net.NZ Ltd, PO Box 11-053, Manners St, Wellington
WEB: http://catalyst.net.nz/ PHYS: Level 2, 150-154 Willis St
DDI: +64(4)916-7201 MOB: +64(21)635-694 OFFICE: +64(4)499-2267
Survey for free with http://survey.net.nz/
---------------------------------------------------------------------

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Josh Berkus 2002-10-17 19:37:59 Re: How to extract hour and minutes from a timestamp
Previous Message Tan ga 2002-10-17 16:52:05 How to extract hour and minutes from a timestamp