current_date
1. CURRENT_DATE Function
=======current_date
1. CURRENT_DATE Function
>>>>>>> 9d19b1c8cb744c8e86d5c15b74d8b5f719ad62beThe CURRENT_DATE function in H2 database is used to retrieve the current date.
2. Syntax
The syntax for the CURRENT_DATE function in H2 database is as follows:
CURRENT_DATE()
Arguments
- None
Return
- The CURRENT_DATE function returns the current date as a DATE value.
3. Notes
- The CURRENT_DATE function does not require any arguments.
- The returned date does not contain any time information, only the date component.
- The date is returned in the format 'YYYY-MM-DD'.
- The CURRENT_DATE function is similar to the
GETDATE()
function in other databases.
4. Examples
Here are a few examples demonstrating the usage of the CURRENT_DATE function in H2 database:
Example 1 - Retrieving the current date:
SELECT CURRENT_DATE() AS current_date;
Output:
current_date
------------
2022-10-25
Example 2 - Using the current date in a query:
SELECT *
FROM orders
WHERE order_date >= CURRENT_DATE();
Output:
order_id | order_date | customer
---------+---------------+-----------
1 | 2022-10-25 | John
2 | 2022-10-26 | Jane
5. Related Functions
- current_time - Retrieve the current time
- current_timestamp - Retrieve the current timestamp