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

Re: [despammed] Day name, month name from a datetime field

From: Andreas Kretschmer <akretschmer(at)despammed(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: [despammed] Day name, month name from a datetime field
Date: 2005-01-04 13:03:18
Message-ID: 20050104130318.GA7083@Pinguin.wug-glas.de (view raw or flat)
Thread:
Lists: pgsql-novice
am  04.01.2005, um 17:43:34 +0530 mailte Deepa K folgendes:
> Hi,
>   I have a table which will have two datetime fields (logintime and
> logouttime).
> 
> logintime : time at which the user is logged in
> logouttime : time at which the user is logged out.
> 
> Is it possible to get the rows from table where the day is sunday.

Yes. to_char(<field>, 'Day')

You can use this in a where-statement.


> 
> And also is it possible to map the days in all rows to day name and similarly
> is it possible to map the month in all rows to month name.

Read the manual about to_char()


Regards, Andreas
-- 
Andreas Kretschmer    (Kontakt: siehe Header)
               Tel. NL Heynitz:  035242/47212
GnuPG-ID 0x3FFF606C http://wwwkeys.de.pgp.net
 ===    Schollglas Unternehmensgruppe    === 

In response to

pgsql-novice by date

Next:From: Sukhdeep JoharDate: 2005-01-04 15:10:04
Subject: pg_config missing in install
Previous:From: Keith WorthingtonDate: 2005-01-04 12:15:56
Subject: Re: Creating a clean database

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