Re: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date

From: Bricklen Anderson <banderson(at)presinet(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:22:29
Message-ID: 48908735.4010601@presinet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Emi Lu wrote:
> 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!
>

http://www.postgresql.org/docs/current/static/functions-formatting.html

select to_char(current_date,'Day');
select to_char(current_date,'D');

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Pavel Stehule 2008-07-30 15:23:41 Re: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date
Previous Message Milen A. Radev 2008-07-30 15:22:27 Re: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date