PostgreSQL CURRENT_TIMESTAMP() function
CURRENT_TIMESTAMP() function
The PostgreSQL CURRENT_TIMESTAMP() function returns the current date and time with time zone information.
Uses of CURRENT_TIMESTAMP() Function
- Retrieve Current Date and Time: Get the current date and time with the time zone.
- Timestamp Comparisons: Use in SQL queries to compare with other timestamp fields.
- Timestamp Calculations: Perform date and time arithmetic for intervals, durations, and other time-related calculations.
- Report Generation: Generate reports with the current date and time.
- Record Creation: Automatically set the creation timestamp for new records.
Syntax:
current_timestamp()
Return Type: timestamp with time zone.
PostgreSQL Version: 9.3
Pictorial Presentation of PostgreSQL CURRENT_TIMESTAMP() function
Example: PostgreSQL CURRENT_TIMESTAMP() function
Code:
SELECT current_timestamp;
Sample Output:
now ---------------------------- 2015-01-14 16:42:26.283-08 (1 row)
N.B. - The outputs may change with current date and time.
Previous: CURRENT_TIME function
Next: DATE_PART 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/current_timestamp-function.php
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics