Funciones para obtener la fecha/hora actual

Funciones para manipular datos en PostgreSQL

Brian Piccolo

Sr. Director, Digital Strategy

Obtener la marca de tiempo actual

SELECT NOW();
+-------------------------------+
| now()                         |
|-------------------------------|
| 2019-04-19 02:51:18.448641+00 |
+-------------------------------+
Funciones para manipular datos en PostgreSQL

Obtener la marca de tiempo actual

SELECT NOW()::timestamp;
+----------------------------+
| now()                      |
|----------------------------+
| 2019-04-19 02:51:18.448641 |
+----------------------------+
Funciones para manipular datos en PostgreSQL

Obtener la marca de tiempo actual

Conversión específica de PostgreSQL

SELECT NOW()::timestamp;

Función CAST()

SELECT CAST(NOW() as timestamp);
Funciones para manipular datos en PostgreSQL

Obtener la marca de tiempo actual

SELECT CURRENT_TIMESTAMP;
+-------------------------------+
| current_timestamp             |
|-------------------------------|
| 2019-04-19 02:51:18.448641+00 |
+-------------------------------+
Funciones para manipular datos en PostgreSQL

Obtener la marca de tiempo actual

SELECT CURRENT_TIMESTAMP(2);
+-------------------------------+
| current_timestamp             |
|-------------------------------|
| 2019-04-19 02:51:18.44+00     |
+-------------------------------+
Funciones para manipular datos en PostgreSQL

Fecha y hora actuales

SELECT CURRENT_DATE;
+--------------+
| current_date |
|--------------|
| 2019-04-19   |
+--------------+
Funciones para manipular datos en PostgreSQL

Fecha y hora actuales

SELECT CURRENT_TIME;
+------------------------+
| current_time           |
|------------------------|
| 04:06:30.929845+00:00  |
+------------------------+
Funciones para manipular datos en PostgreSQL

¡Vamos a practicar!

Funciones para manipular datos en PostgreSQL

Preparing Video For Download...