mirror of
https://github.com/jbranchaud/til
synced 2026-01-16 13:38:02 +00:00
23 lines
385 B
Markdown
23 lines
385 B
Markdown
# Day Of Week For A Date
|
|
|
|
Given a `date` in PostgreSQL
|
|
|
|
```sql
|
|
> 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
|
|
|
|
```sql
|
|
> select date_part('dow', '2050-1-1'::date);
|
|
date_part
|
|
-----------
|
|
6
|
|
```
|
|
|
|
[source](http://www.postgresql.org/docs/current/static/functions-datetime.html)
|