mirror of
https://github.com/jbranchaud/til
synced 2026-01-09 10:08:01 +00:00
Add Intervals Of Time By Week as a postgres til.
This commit is contained in:
18
postgres/intervals-of-time-by-week.md
Normal file
18
postgres/intervals-of-time-by-week.md
Normal file
@@ -0,0 +1,18 @@
|
||||
# Intervals Of Time By Week
|
||||
|
||||
It is pretty common to use hours or days when creating a Postgres
|
||||
interval. However, intervals can also be created in week-sized chunks
|
||||
|
||||
```sql
|
||||
> select '2 weeks'::interval;
|
||||
interval
|
||||
----------
|
||||
14 days
|
||||
(1 row)
|
||||
|
||||
> select make_interval(0,0,7,0,0,0,0);
|
||||
make_interval
|
||||
---------------
|
||||
49 days
|
||||
(1 row)
|
||||
```
|
||||
Reference in New Issue
Block a user