If you would like to upgrade to a newer long-term support version of Studio Pro, see Moving from Mendix Studio Pro 8 to 9.

OQL DATEPART

Last modified: August 27, 2024

The DATEPART function retrieves a specified element from a date/time values. This element is of type integer.

The syntax is as follows:

DATEPART ( datepart , date_expression )
datepartdefinitionexample when used for Friday July 1, 2005, 16:34:20
YEAR2005
QUARTER1, 2, 3 or 43
MONTH1 to 127
DAYOFYEAR1 to 366
DAY1 to 315
WEEK1 to 53 (depends on the database implementation)
WEEKDAY1 to 7 (1 = Sunday, 7 = Saturday)6
HOUR0 to 2316
MINUTE0 to 5934
SECOND0 to 5920

datepart Specifies the part of the date/time value to retrieve. This can be one of the following:

date_expression Specifies the date to retrieve an element from. This should be formatted in an expression which resolves to a date/time value.