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.
--
10Mb na sua caixa de email gratuita no mail.pt
http://www.mail.pt

Search Discussions

  • Andrew McMillan at Oct 17, 2002 at 7:34 pm

    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/
    ---------------------------------------------------------------------
  • Josh Berkus at Oct 17, 2002 at 7:37 pm
    Tan ga,
    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
    Check out "Functions and Operators" in the online user manual.

    What you want is:

    SELECT to_char(some_timestamp, 'HH:MI');

    -Josh Berkus

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppgsql-novice @
categoriespostgresql
postedOct 17, '02 at 5:50p
activeOct 17, '02 at 7:37p
posts3
users3
websitepostgresql.org
irc#postgresql

People

Translate

site design / logo © 2022 Grokbase