now()
Current date and time (start of current transaction); see Section 9.9.5
Signature
now ( ) → timestamp with time zoneIn other engines
| PostgreSQL | now |
|---|---|
| MySQL | NOW() |
| SQL Server | SYSDATETIME(), or GETDATE() for the older lower-precision type |
| Oracle | SYSTIMESTAMP, or SYSDATE without a timezone |
| SQLite | datetime('now'), which is UTC |
PostgreSQL's now() is the transaction start time, not the clock — call it twice in one transaction and you get one answer. clock_timestamp() is the one that moves. SQLite's returns UTC regardless of the session.
Want to run this against your own PostgreSQL server from an iPhone, iPad or Mac? These are ours — every connection goes straight from the device to your database, with no account and no server of ours in between.
Signature and description adapted from the PostgreSQL manual, used under the PostgreSQL License. PostgreSQL is a registered trademark of the PostgreSQL Community Association of Canada. This page is not affiliated with the PostgreSQL Global Development Group.