[comment]: # attributes: notoc

[comment]: # ({3ded7a87-493edd72})
# 3 Date and time functions

All functions listed here are supported in:

-   [Trigger expressions](/manual/config/triggers/expression)
-   [Calculated item formulas](/manual/config/items/itemtypes/calculated)
-   [Expression macros](/manual/config/macros/expression_macros)

::: noteimportant
Date and time functions cannot be used in the expression by themselves; at least one function from [another group](/manual/config/triggers/expression#functions), referencing the host item, must be included in the expression (except the [nodata()](/manual/config/triggers/expression/history#nodata) function). For detailed information on how date and time functions  work within expressions, see [Calculation time](/manual/config/triggers#calculation-time).
:::

The functions are listed without additional information. Click the function to see the full details.

|Function|Description|
|--|--------|
|[date](#date)|The current date in YYYYMMDD format.|
|[dayofmonth](#dayofmonth)|The day of month in range of 1 to 31.|
|[dayofweek](#dayofweek)|The day of week in range of 1 to 7.|
|[now](#now)|The number of seconds since the Epoch (00:00:00 UTC, January 1, 1970).|
|[time](#time)|The current time in HHMMSS format.|

[comment]: # ({/3ded7a87-493edd72})

[comment]: # ({cc36f73e-fbd1f745})
### Function details

[comment]: # ({/cc36f73e-fbd1f745})

[comment]: # ({5bd32636-5fe053df})

##### date

The current date in YYYYMMDD format.

Example:

    date()<20220101

[comment]: # ({/5bd32636-5fe053df})

[comment]: # ({b41d8b0d-9ba00e3f})

##### dayofmonth

The day of month in range of 1 to 31.

Example:

    dayofmonth()=1

[comment]: # ({/b41d8b0d-9ba00e3f})

[comment]: # ({6e794389-d60d267c})

##### dayofweek

The day of week in range of 1 to 7 (Mon - 1, Sun - 7).

Example (only weekdays):

    dayofweek()<6

Example (only weekend):

    dayofweek()>5

[comment]: # ({/6e794389-d60d267c})

[comment]: # ({d6c3ffb1-e049cb14})

##### now

The number of seconds since the Epoch (00:00:00 UTC, January 1, 1970).

Example:

    now()<1640998800

[comment]: # ({/d6c3ffb1-e049cb14})

[comment]: # ({bd95c60c-6f5f853e})

##### time

The current time in HHMMSS format.

Example (only nighttime, 00:00-06:00):

    time()<060000

[comment]: # ({/bd95c60c-6f5f853e})

[comment]: # ({ba58f5e4-30214ece})

See [all supported functions](/manual/config/triggers/expression#functions).

[comment]: # ({/ba58f5e4-30214ece})
