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

From Milen A. Radev
Subject Re: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date
Date
Msg-id g6q0vn$5nv$1@ger.gmane.org
Whole thread Raw
In response to Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date  (Emi Lu <emilu@encs.concordia.ca>)
List pgsql-sql
Emi Lu написа:
> 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?)

You need "TO_CHAR" 
(http://www.postgresql.org/docs/current/static/functions-formatting.html) 
- "SELECT to_char(current_date, 'Dy')".


-- 
Milen A. Radev



pgsql-sql by date:

Previous
From: Emi Lu
Date:
Subject: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date
Next
From: "Pavel Stehule"
Date:
Subject: Re: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date