Reference
Timestamp
Now
| Output | A timestamp instance with the current local date and time. |
|---|
Signature
time_now(): TimestampExample
time_now() // returns the current timestampFrom ISO
| Input | A string representation of a timestamp in ISO 8601 format. |
|---|---|
| Output | A timestamp instance. |
Signature
time_fromIso(a: String): TimestampExample
time_fromIso("2024-01-15T10:30:00.000Z") // returns a timestampFrom Epoch
| Input | The number of milliseconds since the Unix epoch. |
|---|---|
| Output | A timestamp instance. |
Signature
time_fromEpoch(a: Number): TimestampExample
time_fromEpoch(1704067200000) // returns a timestampTo ISO
| Input | A timestamp instance. |
|---|---|
| Output | A string representation of the timestamp in ISO 8601 format. |
Signature
time_toIso(a: Timestamp): StringExample
time_toIso(time_now()) // returns the ISO 8601 stringTo Epoch
| Input | A timestamp instance. |
|---|---|
| Output | The number of milliseconds since the Unix epoch. |
Signature
time_toEpoch(a: Timestamp): NumberExample
time_toEpoch(time_now()) // returns the epoch time in millisecondsFormat
| Input | A timestamp and a format pattern string. |
|---|---|
| Output | A string representation of the timestamp in the specified format. |
Signature
time_format(a: Timestamp, b: String): StringExample
time_format(time_now(), "yyyy-MM-dd") // returns "2024-01-15"Year
| Input | A timestamp instance. |
|---|---|
| Output | The year of the timestamp. |
Signature
time_year(a: Timestamp): NumberExample
time_year(time_fromIso("2024-01-15T10:30:00.000Z")) // returns 2024Month
| Input | A timestamp instance. |
|---|---|
| Output | The month of the timestamp (1-12). |
Signature
time_month(a: Timestamp): NumberExample
time_month(time_fromIso("2024-01-15T10:30:00.000Z")) // returns 1Day
| Input | A timestamp instance. |
|---|---|
| Output | The day of the timestamp (1-31). |
Signature
time_day(a: Timestamp): NumberExample
time_day(time_fromIso("2024-01-15T10:30:00.000Z")) // returns 15Day of Week
| Input | A timestamp instance. |
|---|---|
| Output | The day of the week (1-7, where 1 is Monday). |
Signature
time_dayOfWeek(a: Timestamp): NumberExample
time_dayOfWeek(time_now()) // returns 1-7 (Monday=1)Day of Year
| Input | A timestamp instance. |
|---|---|
| Output | The day of the year (1-366). |
Signature
time_dayOfYear(a: Timestamp): NumberExample
time_dayOfYear(time_now()) // returns 1-366Hour
| Input | A timestamp instance. |
|---|---|
| Output | The hour of the timestamp (0-23). |
Signature
time_hour(a: Timestamp): NumberExample
time_hour(time_fromIso("2024-01-15T10:30:00.000Z")) // returns 10Minute
| Input | A timestamp instance. |
|---|---|
| Output | The minute of the timestamp (0-59). |
Signature
time_minute(a: Timestamp): NumberExample
time_minute(time_fromIso("2024-01-15T10:30:00.000Z")) // returns 30Second
| Input | A timestamp instance. |
|---|---|
| Output | The second of the timestamp (0-59). |
Signature
time_second(a: Timestamp): NumberExample
time_second(time_fromIso("2024-01-15T10:30:45.000Z")) // returns 45Millisecond
| Input | A timestamp instance. |
|---|---|
| Output | The millisecond of the timestamp (0-999). |
Signature
time_millisecond(a: Timestamp): NumberExample
time_millisecond(time_fromIso("2024-01-15T10:30:00.500Z")) // returns 500Compare
| Input | Two timestamp instances. |
|---|---|
| Output | 1 if the first timestamp is bigger than the second. -1 if it is the smaller. 0 if they are equal. |
Signature
time_compare(a: Timestamp, b: Timestamp): NumberExample
time_compare(time_fromIso("2024-02-01T00:00:00Z"), time_fromIso("2024-01-01T00:00:00Z")) // returns 1Is Before
| Input | Two timestamps. |
|---|---|
| Output | True if the first timestamp is before the second, false otherwise. |
Signature
time_isBefore(a: Timestamp, b: Timestamp): BooleanExample
time_isBefore(yesterday, time_now()) // returns trueIs After
| Input | Two timestamps. |
|---|---|
| Output | True if the first timestamp is after the second, false otherwise. |
Signature
time_isAfter(a: Timestamp, b: Timestamp): BooleanExample
time_isAfter(time_now(), yesterday) // returns trueAdd
| Input | A timestamp and a duration. |
|---|---|
| Output | A new timestamp with the duration added. |
Signature
time_add(a: Timestamp, b: Duration): TimestampExample
time_add(time_now(), duration_fromHours(2)) // returns timestamp 2 hours from nowSubtract
| Input | A timestamp and a duration. |
|---|---|
| Output | A new timestamp with the duration subtracted. |
Signature
time_subtract(a: Timestamp, b: Duration): TimestampExample
time_subtract(time_now(), duration_fromDays(1)) // returns timestamp 1 day agoBetween
| Input | Two timestamps. |
|---|---|
| Output | The duration between the two timestamps. |
Signature
time_between(a: Timestamp, b: Timestamp): DurationExample
time_between(t1, t2) // returns the duration between t1 and t2Is Leap Year
| Input | A year as a number. |
|---|---|
| Output | True if the year is a leap year, false otherwise. |
Signature
time_isLeapYear(a: Number): BooleanExample
time_isLeapYear(2024) // returns true