current_time
1. CURRENT_TIME Function
=======current_time
1. CURRENT_TIME Function
>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62beThe CURRENT_TIME function in H2 database is used to retrieve the current system time.
2. Syntax
The syntax for the CURRENT_TIME function in H2 database is as follows:
CURRENT_TIME
Arguments
- This function does not require any arguments.
Return
- The CURRENT_TIME function returns the current system time as a TIME value.
3. Notes
- The CURRENT_TIME function in H2 database does not require any arguments.
- The returned time value is based on the system clock of the database server.
- The time is returned in the format
HH:mm:ss
, where HH represents hours (00-23), mm represents minutes (00-59), and ss represents seconds (00-59).
4. Examples
Here are a few examples demonstrating the usage of the CURRENT_TIME function in H2 database:
Example 1 - Retrieving the current system time:
SELECT CURRENT_TIME AS current_time;
Output:
current_time
------------
14:35:42
Example 2 - Using CURRENT_TIME in a condition:
SELECT *
FROM orders
WHERE order_time >= CURRENT_TIME - INTERVAL '1' HOUR;
Output:
order_id | order_time | product
---------+---------------------+---------
1 | 2022-07-01 13:45:00 | A
2 | 2022-07-01 14:00:00 | B
3 | 2022-07-01 14:30:00 | C
5. Related Functions
- current_date - Retrieve the current date
- current_timestamp - Retrieve the current timestamp (date and time)