ConstOperator / Temporal Layer

Perform addition or subtraction of constant duration values to datetime columns, similar to pandas timedelta operations or SQL DATEADD().

Example operations:

Input DateTimeOperationDurationResult DateTimeNote
2024-01-15 12:00:00Add1d12h2024-01-17 00:00:00Forward time
2024-01-15 12:00:00Sub2w2024-01-01 12:00:00Backward time
2024-01-31 12:00:00Add1mo2024-02-29 12:00:00Month aware

Duration units:

  • ns: Nanoseconds (1/1,000,000,000 second)
  • us: Microseconds (1/1,000,000 second)
  • ms: Milliseconds (1/1,000 second)
  • s: Seconds
  • m: Minutes
  • h: Hours
  • d: Days
  • w: Weeks
  • mo: Months
  • q: Quarters
  • y: Years
  • i: Index positions

Common applications:

  • Date shifting
  • Deadline calculation
  • Schedule planning
  • Period analysis
  • Event scheduling
  • Time window operations
Table
0
0
Table

Select

column

DateTime column to modify. Operation preserves time components and handles:

  • Month length variations
  • Leap years
  • Timezone transitions
Add

Arithmetic operation to perform with the duration constant.

Add ~

Add duration to move forward in time. Examples:

  • Add 1d: Tomorrow same time
  • Add 1mo: Next month same day
  • Add 1y: Next year same date
Sub ~

Subtract duration to move backward in time. Examples:

  • Sub 1d: Yesterday same time
  • Sub 1mo: Previous month same day
  • Sub 1y: Previous year same date

Value

string

Duration string specifying time delta. Format: combination of quantity and unit. Examples:

  • '1d': One day
  • '2h30m': Two hours thirty minutes
  • '1y6mo': One year six months
  • '1w2d12h': One week two days twelve hours Units can be combined (1y2mo3d4h5m6s)

Name for the new column. If not provided, the system generates a unique name. If AsColumn matches an existing column, the existing column is replaced. The name should follow valid column naming conventions.