Connecting Tech Pros Worldwide Forums | Help | Site Map

day from date

Newbie
 
Join Date: Sep 2008
Posts: 1
#1: Sep 8 '08
Is there a function in postgresql to find weekday from date?
E.g. Given 2008-09-08 , it returns Monday.
Moderator
 
Join Date: Dec 2006
Location: Europe
Posts: 292
#2: Sep 8 '08

re: day from date


I do not hear about that function but you can write a simple query

Expand|Select|Wrap|Line Numbers
  1. Select case extract(dow from '2008-09-08'::date)
  2. when 0 then 'Sunday'
  3. when 1 then 'Monday'
  4. when 2 then 'Tuesday'
  5. when 3 then 'Wednesday'
  6. when 4 then 'Thursday
  7. when 5 then 'Friday'
  8. when 6 then 'Saturday'
  9. end;
  10.  
Reply