Date Functions in Scripts¶
The qie script binding exposes helpers for the current system time and for testing whether a date is within a given offset of "now". The dateUnit parameter on these helpers accepts the same set of unit names supported by the {SYSTEM_DATE} and {UTC_DATE} node tags, so the same offset semantics work whether you reach for a node tag or a JavaScript call.
Accepted dateUnit values¶
| Long form | Short code(s) |
|---|---|
YEAR |
y |
MONTH |
M |
WEEK |
W or w |
DAY |
d |
HOUR |
H |
MINUTE |
m |
SECOND |
s |
MILLISECOND |
S |
Long forms are case-sensitive (YEAR, not year). Short codes are case-sensitive except W / w. The constants on qie.DateUnit (qie.DateUnit.DAY, etc.) resolve to the long forms.
qie.getSystemDate() and qie.getSystemDate(offset, dateUnit)¶
The no-arg form returns the current system date/time formatted as yyyyMMddHHmmss.SSS in the JVM default timezone:
The two-argument overload returns the system date/time shifted by offset units of dateUnit, in the same yyyyMMddHHmmss.SSS format. A positive offset returns a future instant; a negative offset returns a past instant; zero returns the unshifted system date. The accepted dateUnit values are listed above.
var yesterday = qie.getSystemDate(-1, "DAY");
var inFiveMinutes = qie.getSystemDate(5, "m");
var lastWeek = qie.getSystemDate(-1, "W");
qie.isDateWithin(date, offset, dateUnit)¶
Returns true if date is inclusively within offset units of the current system time:
- A positive
offsetchecks the future; a negativeoffsetchecks the past. Passing0throws anIllegalArgumentException. - For
DAY,WEEK,MONTH, andYEAR, the comparison snaps bothdateand "now" to day boundaries, start-of-day for negative offsets, end-of-day for positive. This is the long-standing behavior; any time component ondateis ignored. - For
HOUR,MINUTE,SECOND, andMILLISECOND, the comparison uses instant precision, neither side is snapped, so adatecarrying an explicit time is compared at the actual instant. Adatewithout a time component (e.g."2026-01-15") is resolved by QIE to midnight in the JVM default timezone.