mirror of
https://github.com/Fechin/reference.git
synced 2026-11-20 21:23:11 +03:00
Merge pull request #356 from adeiltonsantanaa/adeiltonsantanaaupdate-postgres
Creating a reference to some date functions
This commit is contained in:
1 file changed
+20
@@ -332,6 +332,26 @@ DROP SCHEMA IF EXISTS <schema_name> CASCADE;
|
||||
```
|
||||
|
||||
|
||||
### Dates
|
||||
|
||||
Show [current date](https://www.postgresql.org/docs/15/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT) YYYY-MM-DD
|
||||
```sql {.wrap}
|
||||
SELECT current_date;
|
||||
```
|
||||
Calculate [age](https://www.postgresql.org/docs/15/functions-datetime.html#:~:text=age%20(%20timestamp%2C%20timestamp%20)%20%E2%86%92%20interval) between two dates
|
||||
```sql {.wrap}
|
||||
SELECT age(timestamp, timestamp);
|
||||
```
|
||||
Show [current time](https://www.postgresql.org/docs/15/functions-datetime.html#FUNCTIONS-DATETIME-CURRENT) with time zone
|
||||
```sql {.wrap}
|
||||
SELECT current_time;
|
||||
```
|
||||
[Make](https://www.postgresql.org/docs/15/functions-datetime.html#:~:text=make_date%20(%20year%20int%2C%20month%20int%2C%20day%20int%20)%20%E2%86%92%20date) dates using integers
|
||||
```sql {.wrap}
|
||||
SELECT make_date(2021,03,25);
|
||||
```
|
||||
|
||||
|
||||
|
||||
PostgreSQL Commands
|
||||
-----------
|
||||
|
||||
Reference in new issue
Block a user