Date and Time Functions
CURRENT_DATE
{CURRENT_DATE [()] | CURDATE() | SYSDATE | TODAY}
Description
Returns the current date. This method always returns the same value within a transaction.
Examples
CURRENT_DATE()
CURRENT_TIME
{CURRENT_TIME [ () ] | CURTIME()}
Description
Returns the current time. This method always returns the same value within a transaction.
Examples
CURRENT_TIME()
CURRENT_TIMESTAMP
{CURRENT_TIMESTAMP [([int])] | NOW([int])}
Description
Returns the current timestamp. The precision parameter for nanoseconds precision is optional. This method always returns the same value within a transaction.
Examples
CURRENT_TIMESTAMP()
DATEADD
{DATEADD| TIMESTAMPADD} (unitString, addIntLong, timestamp)
Description
Adds units to a timestamp. The string indicates the unit. Use negative values to subtract units. addIntLong may be a long value when manipulating milliseconds, otherwise its range is restricted to int. The same units as in the EXTRACT function are supported. The DATEADD method returns a timestamp. The TIMESTAMPADD method returns a long.
Examples
DATEADD('MONTH', 1, DATE '2001-01-31')
DATEDIFF
{DATEDIFF | TIMESTAMPDIFF} (unitString, aTimestamp, bTimestamp)
Description
Returns the the number of crossed unit boundaries between two timestamps. This method returns a long. The string indicates the unit. The same units as in the EXTRACT function are supported.
Examples
DATEDIFF('YEAR', T1.CREATED, T2.CREATED)
DAYNAME
DAYNAME(date)
Description
Returns the name of the day (in English).
Examples
DAYNAME(CREATED)
DAY_OF_MONTH
DAY_OF_MONTH(date)
Description
Returns the day of the month (1-31).
Examples
DAY_OF_MONTH(CREATED)
DAY_OF_WEEK
DAY_OF_WEEK(date)
Description
Returns the day of the week (1 means Sunday).
Examples
DAY_OF_WEEK(CREATED)
DAY_OF_YEAR
DAY_OF_YEAR(date)
Description
Returns the day of the year (1-366).
Examples
DAY_OF_YEAR(CREATED)
EXTRACT
SUGGEST EDITS
EXTRACT ({EPOCH | YEAR | YY | QUARTER | MONTH | MM | WEEK | ISO_WEEK
| DAY | DD | DAY_OF_YEAR | DOY | DAY_OF_WEEK | DOW | ISO_DAY_OF_WEEK
| HOUR | HH | MINUTE | MI | SECOND | SS | MILLISECOND | MS
| MICROSECOND | MCS | NANOSECOND | NS}
FROM timestamp)
Description
Returns a specific value from a timestamps. This method returns an int.
Examples
EXTRACT(SECOND FROM CURRENT_TIMESTAMP)
FORMATDATETIME
FORMATDATETIME (timestamp, formatString [,localeString [,timeZoneString]])
Description
Formats a date, time, or timestamp as a string. The most important format characters are: y year, M month, d day, H hour, m minute, s second. For details about the format, see java.text.SimpleDateFormat. This method returns a string.
Examples
FORMATDATETIME(TIMESTAMP '2001-02-03 04:05:06', 'EEE, d MMM yyyy HH:mm:ss z', 'en', 'GMT')
HOUR
HOUR(timestamp)
Description
Returns the hour (0-23) from a timestamp.
Examples
HOUR(CREATED)
MINUTE
MINUTE(timestamp)
Description
Returns the minute (0-59) from a timestamp.
Examples
MINUTE(CREATED)
MONTH
MONTH(timestamp)
Description
Returns the month (1-12) from a timestamp.
Examples
MONTH(CREATED)
MONTHNAME
MONTHNAME(date)
Description
Returns the name of the month (in English).
Examples
MONTHNAME(CREATED)
PARSEDATETIME
SUGGEST EDITS
PARSEDATETIME(string, formatString [, localeString [, timeZoneString]])
Description
Parses a string and returns a timestamp. The most important format characters are: y year, M month, d day, H hour, m minute, s second. For details about the format, see java.text.SimpleDateFormat.
Examples
PARSEDATETIME('Sat, 3 Feb 2001 03:05:06 GMT', 'EEE, d MMM yyyy HH:mm:ss z', 'en', 'GMT')
QUARTER
QUARTER(timestamp)
Description
Returns the quarter (1-4) from a timestamp.
Examples
QUARTER(CREATED)
SECOND
SECOND(timestamp)
Description
Returns the second (0-59) from a timestamp.
Examples
SECOND(CREATED)
WEEK
WEEK(timestamp)
Description
Returns the week (1-53) from a timestamp. This method uses the current system locale.
Examples
WEEK(CREATED)
YEAR
YEAR(timestamp)
Description
Returns the year from a timestamp.
Examples
YEAR(CREATED)
© 2021 GridGain Systems, Inc. All Rights Reserved. Privacy Policy | Legal Notices. GridGain® is a registered trademark of GridGain Systems, Inc.
Apache, Apache Ignite, the Apache feather and the Apache Ignite logo are either registered trademarks or trademarks of The Apache Software Foundation.