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

From: Emi Lu <emilu(at)encs(dot)concordia(dot)ca>
To: PostgreSQL SQL List <pgsql-sql(at)postgresql(dot)org>
Subject: Get day name(Mon, Tue... Sun) and day number (1, 2...7) from a date
Date: 2008-07-30 15:08:52
Message-ID: 48908404.2040804@encs.concordia.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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!

Responses

Browse pgsql-sql by date

  From Date Subject
Next 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
Previous Message Richard Huxton 2008-07-29 21:29:50 Re: Identifying which column matches a full text search