From: | "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com> |
---|---|
To: | emilu(at)encs(dot)concordia(dot)ca |
Cc: | "PostgreSQL SQL List" <pgsql-sql(at)postgresql(dot)org> |
Subject: | Re: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date |
Date: | 2008-07-30 15:23:41 |
Message-ID: | 162867790807300823w1281f6cr500c2bc8f54c1220@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hello
use to_char function
postgres=# select to_char(current_date, 'day');
to_char
-----------
wednesday
(1 row)
postgres=# select extract(dow from current_date);
date_part
-----------
3
(1 row)
regards
Pavel
2008/7/30 Emi Lu <emilu(at)encs(dot)concordia(dot)ca>:
> Good morning,
>
> Could someone tell me the command to get the weekly day name and day number
> please.
>
>
> I am expecting something like:
>
> sql> select data_part('day name', current_date);
> sql> Monday
>
> sql> select data_part('day number', current_date);
> sql> 1
>
> (Mon =1 ... Sun =7?)
>
> Thanks a lot!
>
> --
> Sent via pgsql-sql mailing list (pgsql-sql(at)postgresql(dot)org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-sql
>
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Toews | 2008-07-30 15:31:57 | order function in aggregate |
Previous Message | Bricklen Anderson | 2008-07-30 15:22:29 | Re: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date |