Applies to: offset

OPC Date

OPC Date expressions let you define dynamic time values without typing exact timestamps. This is useful when selecting periods in trends.

What OPC Date Means

An OPC Date expression combines:

  1. A base time, for example NOW or DAY.
  2. An optional positive or negative offset, for example -1D or +2H.
  3. An optional fixed clock time, for example +08:00.

This lets you create reusable time expressions such as:

NOW
NOW-1D
DAY+08:00
WEEK+1W
MONTH+15D
YEAR+6MO

Base Keywords

Keyword Meaning
NOW Current date and time
SECOND Start of current second
MINUTE Start of current minute
HOUR Start of current hour
DAY Start of current day
WEEK Start of current week
MONTH Start of current month
YEAR Start of current year

Offset Units

Unit Meaning Example
Y Years 2Y
MO Months 3MO
W Weeks 2W
D Days 10D
H Hours 12H
M Minutes 30M
S Seconds 45S

Positive Offsets

NOW+1D
DAY+8H
MONTH+15D

Negative Offsets

NOW-1D
NOW-3H
YEAR-2MO

Chained Offsets

Multiple duration segments may be combined:

NOW+1Y-2MO+3D+4H

Evaluation occurs sequentially.

Example:

NOW
  + 1 year
  - 2 months
  + 3 days
  + 4 hours

This sequential behavior is important because month/year calculations depend on calendar boundaries.


Time-of-Day Offsets

A fixed time can be supplied using:

HH:mm

Examples:

DAY+08:00
DAY+17:30
MONTH+12:00

Meaning:

DAY+08:00

→ Start of current day at 08:00 AM

Examples

Assume:

Date 2025-01-15T14:30:45
Expression Result
NOW 2025-01-15 14:30:45
NOW-1D 2025-01-14 14:30:45
NOW+2H 2025-01-15 16:30:45
DAY 2025-01-15 00:00:00
DAY+08:00 2025-01-15 08:00:00
HOUR 2025-01-15 14:00:00
MINUTE 2025-01-15 14:30:00
WEEK Start of current week
MONTH 2025-01-01 00:00:00
YEAR 2025-01-01 00:00:00

Important Notes

Case Insensitive

All expressions are normalized to uppercase:

now-1d
Now-1D
NOW-1D

are equivalent.


Time Offset Format

Only:

HH:mm

is supported.

Examples:

08:00
17:30
23:59

Seconds are not supported in the expression syntax, although the internal timestamp parser can handle them if supplied directly.


Example Use Cases

Start of Business Day

DAY+09:00

Previous Day

NOW-1D

First Day of Current Month

MONTH

Midday of Current Month

MONTH+12:00

One Week From Start of Current Week

WEEK+1W

Six Months Into Current Year

YEAR+6MO