Example 1
Select the current timestamp
The returned value changes every time the query runs. MySQL and MariaDB return a DATETIME with second precision. SQL Server returns a DATETIME with milliseconds. PostgreSQL returns a TIMESTAMPTZ with a timezone offset. Use CURRENT_TIMESTAMP in DEFAULT column definitions to automatically record when rows are inserted.
SELECT
CURRENT_TIMESTAMP AS now;| now |
|---|
| <current_timestamp> |
The actual value reflects the time of execution and will differ. SQL Server includes milliseconds; PostgreSQL includes a timezone offset.