Date and Time Functions

Date and Time functions are used in calculated tag expressions to retrieve, convert, manipulate, and evaluate date and time values. These functions support time-zone conversion, extraction of date components, and calculation of date-based values.

Function Reference:

Function

Name

Description

Format

Returned Value

now

Trigger Time (Local)

Returns the local trigger time that invoked the calculation.

now()

DateTime

utcnow

Trigger Time (UTC)

Returns the UTC trigger time that invoked the calculation.

utcnow()

DateTime

yday

Yesterday Date

Returns the previous day with the time set to 12:00:00 AM.

yday()

DateTime

today

Today Date

Returns the current date with the time set to 12:00:00 AM.

today()

DateTime

mintime

Minimum Time

Returns the minimum DateTime value supported by the system.

mintime()

DateTime

maxtime

Maximum Time

Returns the maximum DateTime value supported by the system.

maxtime()

DateTime

tolocal

Convert to Local Time

Converts a UTC timestamp to local time.

tolocal(sourceTime)

sourceTime: Specifies the DateTime value to convert.

DateTime

toutc

Convert to UTC Time

Converts a local timestamp to UTC.

toutc(sourceTime)

sourceTime: Specifies the DateTime value to convert.

DateTime

isdst

Is Daylight Saving Time

Returns whether the specified timestamp falls within daylight saving time.

isdst(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Boolean

noon

Noon Time

Returns the specified date with the time set to 12:00:00 PM.

noon(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

DateTime

bday

Beginning of Day

Returns the specified date with the time set to 12:00:00 AM.

bday(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

DateTime

bmonth

Beginning of Month

Returns the first day of the specified month at 12:00:00 AM.

bmonth(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

DateTime

byear

Beginning of Year

Returns the first day of the specified year at 12:00:00 AM.

byear(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

DateTime

second

Second Fragment

Returns the second component of a timestamp.

second(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Integer

minute

Minute Fragment

Returns the minute component of a timestamp.

minute(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Integer

hour

Hour Fragment

Returns the hour component of a timestamp.

hour(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Integer

day

Day Fragment

Returns the day component of a date.

day(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Integer

month

Month Fragment

Returns the month component of a date.

month(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Integer

year

Year Fragment

Returns the year component of a date.

year(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Integer

yearday

Day of Year

Returns the day number within the year.

yearday(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Integer

weekday

Day of Week

Returns the day of the week as an integer from 0 to 6.

weekday(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Integer

dayseconds

Day Total Seconds

Returns the number of elapsed seconds within the day.

dayseconds(sourceTime)

sourceTime: Specifies the DateTime value to evaluate.

Integer