Qore SqlUtil Module Reference  1.5.2
cop_trunc_date formats

Variables

const SqlUtil::DT_DAY = "D"
 Format unit: day.
 
const SqlUtil::DT_HOUR = "H"
 Format unit: hour.
 
const SqlUtil::DT_MINUTE = "m"
 Format unit: minute.
 
const SqlUtil::DT_MONTH = "M"
 Format unit: month.
 
const SqlUtil::DT_SECOND = "S"
 Format unit: hour.
 
const SqlUtil::DT_YEAR = "Y"
 Format unit: year.
 

Detailed Description

These are formatting constant which can be used in cop_trunc_date() formatting argument.

Input date used in the table below: 20.4.2017 14:27:34

Constant Meaning Example
DT_YEAR Truncate date up to year 1.1.2017 00:00:00
DT_MONTH Truncate date up to month 1.4.2017 00:00:00
DT_DAY Truncate date up to day 20.4.2017 00:00:00
DT_HOUR Truncate date up to hour 20.4.2017 14:00:00
DT_MINUTE Truncate date up to minute 20.4.2017 14:27:00
DT_SECOND Truncate date up to second 20.4.2017 14:27:34
Note
Oracle: using DT_SECOND for DATE type does not make sense as the DATE resolution is up to seconds out of the box. On the other side TINESTAMP is truncated up to seconds with this operator.