DATEPART
Usage
Use this function to return a part of a Date or of a Timespan. Available keys for a date are: dayofmonth, dayofweek, dayofyear, week, month, year, yearmonth, hour, minute, hourminute. Available keys for a Timespan are: days, hours, totalhours, minutes, totalminutes, seconds, totalseconds
Category | Function | Type | Where to use | Argument statement |
---|---|---|---|---|
FUNCTION | SERVER ROW | DATE | .VALUE |
Syntax
1 |
|
Arguments
Value
any date or timespan cell value (#Storage_Name.Field_Name.VALUE
or .OLDVALUE
), System Variables or function-returned date or timespan value
Key
For Date: dayofmonth
, dayofweek
, dayofyear
, week
, month
, year
, yearmonth
, hour
, minute
, hourminute
(not key sensitive)
For Timespan: days
, hours
, totalhours
, minutes
, totalminutes
, seconds
, totalseconds
(not key sensitive)
Return Value
Numeric
Examples
Example 1
Formula
=DATEPART("31/12/2020"; dayofyear)
Description
Return from the date 31/12/2020 the day of the year
Result
365
Example 2
Formula
=DATEPART(#StorageExample.Date.VALUE; month)
Description
Return from the cell values of the field date type Date in the StorageExample the month
Result
The month expressed in number
Example 3
Formula
=DATEPART(#StorageExample.Timespan.VALUE; hours)
Description
Return from the cell values of the field timespan type Timespan in the StorageExample the hours
Result
Hours