TRUNCATE() — Truncates a VoltDB date or timestamp to the specified time unit.
TRUNCATE( time-unit, input-value )
The TRUNCATE() function truncates a date or timestamp value to the specified time unit. The datatype of the input value (DATE or TIMESTAMP) determines the datatype of the return value. For example, if the TIMESTAMP column Apollo has the value July 20, 1969 4:17:40 P.M, then using the function TRUNCATE(hour,apollo) would return the value July 20, 1969 4:00:00 P.M. as a TIMESTAMP. Allowable time units for truncation include the following:
YEAR
QUARTER
MONTH
DAY
HOUR
MINUTE
SECOND
MILLISECOND, MILLIS
The following example uses the TRUNCATE function to find records where the timestamp column, incident, falls within a specific day, entered as a POSIX time value.
SELECT incident, description FROM securitylog WHERE TRUNCATE(DAY, incident) = TRUNCATE(DAY,FROM_UNIXTIME(?)) ORDER BY incident, description;