PostgreSQL NOW() function
NOW() function
The PostgreSQL NOW() function is used to get the current date and time at the start of the current transaction.
Uses of NOW() Function
- Retrieve the current date and time with time zone.
- Obtain a consistent timestamp for the duration of the current transaction.
- Useful in logging and auditing to capture the exact time a transaction started.
Syntax:
now()
Return Type: timestamp with time zone
PostgreSQL Version: 9.3
Pictorial Presentation of PostgreSQL NOW() function
Example: PostgreSQL NOW() function:
Code:
SELECT now();
Sample Output:
now ---------------------------- 2015-01-15 14:17:25.919-08 (1 row)
N.B. - The outputs may change during the execution for the current date and time.
Previous: LOCALTIMESTAMP function
Next: STATEMENT_TIMESTAMP function
It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.
https://w3resource.com/PostgreSQL/now-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics