1
0
mirror of https://github.com/jbranchaud/til synced 2026-01-03 23:28:02 +00:00
Files
til/postgres/day-of-week-for-a-date.md
2016-01-29 21:37:28 -06:00

385 B

Day Of Week For A Date

Given a date in PostgreSQL

> select '2050-1-1'::date;
    date
------------
 2050-01-01

you can determine the day of the week for that date with the date_part() function

> select date_part('dow', '2050-1-1'::date);
 date_part
-----------
         6

source