---
url: /set-instructions/time-functions.md
description: Reference for Time Functions in MODLR.
---

# Time Functions

Two instructions add an element *relative to* whatever is already at the edge of the working list, rather than referencing a specific element by name. They're most often used against the Time dimension - "whatever comes after the last period already in the set" - but work against any hierarchy where relative position is meaningful.

| Instruction | What it does |
| --- | --- |
| [Insert The Next Element From A Hierarchy](/set-instructions/insert-the-next-element-from-a-hierarchy) | Adds the element immediately after the current last element in the working list - e.g. "the next month" relative to wherever the set currently ends. |
| [Insert The Previous Element From A Hierarchy](/set-instructions/insert-the-previous-element-from-a-hierarchy) | The mirror instruction - adds the element immediately before the current first element. |

## Why relative, not fixed

A set built with a hardcoded period (`2024 - Jan`) has to be edited every time the reporting period rolls forward. A set that instead says "the period after whatever's already here" keeps working unchanged as time moves on - useful for rolling views like "current month plus the next two" or "trailing three months," built once and left alone.

These two instructions are listed under [Element Insertion](/set-instructions/advanced-functions#element-insertion) in the sidebar alongside the other ways of adding elements to a set (from context, from a variable, or by formula) - this page groups them separately because their relative, hierarchy-position-based behaviour is a distinct concept worth recognising on its own.
