Thread: know the day from timestamp..

know the day from timestamp..

From
jerome
Date:
is there a function that will say the day (monday... sunday) in numeric...

input -- 2002-09-12 20:44:21+08 or just date -- 2002-09-12

will output thursday or 4 just like the date command for the shell..


TIA

know the day from timestamp..

From
Lee Kindness
Date:
See:

 http://www.postgresql.org/idocs/index.php?functions-datetime.html#FUNCTIONS-DATETIME-EXTRACT

in particular for your example:

 SELECT EXTRACT(DOW FROM TIMESTAMP '2002-09-12 20:44:21');

Lee.

jerome writes:
 > is there a function that will say the day (monday... sunday) in numeric...
 >
 > input -- 2002-09-12 20:44:21+08 or just date -- 2002-09-12
 >
 > will output thursday or 4 just like the date command for the shell..

Re: know the day from timestamp..

From
Stephan Szabo
Date:
On Thu, 12 Sep 2002, jerome wrote:

> is there a function that will say the day (monday... sunday) in numeric...
>
> input -- 2002-09-12 20:44:21+08 or just date -- 2002-09-12
>
> will output thursday or 4 just like the date command for the shell..

I believe EXTRACT(DOW from <timestamp>)
will give you a numeric day of week.