Re: newbie:how can i get day of week data type...

From: Jason Earl <jdearl(at)yahoo(dot)com>
To: Muhammad Rusydi <rusydi(at)cbn(dot)net(dot)id>, postgres general <pgsql-general(at)postgresql(dot)org>
Subject: Re: newbie:how can i get day of week data type...
Date: 2001-06-14 19:58:09
Message-ID: 20010614195809.32303.qmail@web10006.mail.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)cbn(dot)net(dot)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/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2001-06-14 20:10:50 Re: problem connecting from another host
Previous Message Dick Brooks 2001-06-14 19:16:29 Use of C function parameters from embedded SQL