Re: newbie:how can i get day of week data type... - Mailing list pgsql-general

From Jason Earl
Subject Re: newbie:how can i get day of week data type...
Date
Msg-id 20010614195809.32303.qmail@web10006.mail.yahoo.com
Whole thread Raw
In response to newbie:how can i get day of week data type...  ("Muhammad Rusydi" <rusydi@cbn.net.id>)
List pgsql-general
The information you need can be found here:

http://www.postgresql.org/idocs/index.php?functions-datetime.html

look specifically at the extract and date_part
functions.  You could get what you need by concatting
th date value and the time value (with a space in
between) casting the result as a timestamp and running
it through the date_part function using the 'dow'
parameter.  Here's an example:

processdata=# select date_part('dow', ('20/06/2001' ||
' ' || '08:00:00')::timestamp);

 date_part
-----------
         3

The number return is an integer between 0-6 where 0 is
Sunday.

Hope this is helpful,
Jason

--- Muhammad Rusydi <rusydi@cbn.net.id> wrote:
> i've created this table:
> create table schedule (
> day date,
> tm timestamp,
> room char(4));
>
> insert into schedule values
> ('20/06/2001','08:00:00','A104');
>
> my problem is how to get day of week information
> from date or is there any
> way to do this?
> would you show me how to do it?
> thank's
> Didi
>
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
> http://www.postgresql.org/search.mpl


__________________________________________________
Do You Yahoo!?
Get personalized email addresses from Yahoo! Mail - only $35
a year!  http://personal.mail.yahoo.com/

pgsql-general by date:

Previous
From: Frank Miles
Date:
Subject: Re: problem connecting from another host
Next
From: Tom Lane
Date:
Subject: Re: problem connecting from another host