$timestamp
Updated on Aug 29, 2025 11 minutes to readThe Timestamp Plugin provides methods to work with date and time values including parsing, validation, arithmetic, component access, start/end of units, and difference calculation.
Methods
server Method | Description |
---|---|
addDays | Adds a number of days to a timestamp. |
addHours | Adds a number of hours to a timestamp. |
addMinutes | Adds a number of minutes to a timestamp. |
addMonths | Adds a number of months to a timestamp. |
addQuarters | Adds a number of quarters to a timestamp. |
addSeconds | Adds a number of seconds to a timestamp. |
addWeeks | Adds a number of weeks to a timestamp. |
addYears | Adds a number of years to a timestamp. |
current | Returns the current timestamp. |
currentTimeZone | Returns the current time zone of the environment. |
date | Returns the date component of a timestamp. |
day | Gets or sets the day component of a timestamp. |
diff | Calculates the difference between two timestamps in a specified unit. |
endOfDay | Returns the timestamp at the end of the day. |
endOfMonth | Returns the timestamp at the end of the month. |
endOfQuarter | Returns the timestamp at the end of the quarter. |
endOfWeek | Returns the timestamp at the end of the week. |
endOfYear | Returns the timestamp at the end of the year. |
hour | Gets or sets the hour component of a timestamp. |
isValid | Checks whether a value is a valid. |
minute | Gets or sets the minute component of a timestamp. |
month | Gets or sets the month component of a timestamp. |
parse | Parses date and time values. |
second | Gets or sets the second component of a timestamp. |
startOfDay | Returns the timestamp at the start of the day. |
startOfMonth | Returns the timestamp at the start of the month. |
startOfQuarter | Returns the timestamp at the start of the quarter. |
startOfWeek | Returns the timestamp at the start of the week. |
startOfYear | Returns the timestamp at the start of the year. |
time | Returns the time component of a timestamp. |
year | Gets or sets the year component of a timestamp. |
Methods Details
addDays()
• Type
(value: E8Timestamp, days: number) => E8Timestamp
• Details
Expects a E8Timestamp and a number of days to add.
Returns an updated E8Timestamp.
addHours()
• Type
(value: E8Timestamp, hours: number) => E8Timestamp
• Details
Expects a E8Timestamp and a number of hours to add.
Returns an updated E8Timestamp.
addMinutes()
• Type
(value: E8Timestamp, minutes: number) => E8Timestamp
• Details
Expects a E8Timestamp and a number of minutes to add.
Returns an updated E8Timestamp.
addMonths()
• Type
(value: E8Timestamp, months: number) => E8Timestamp
• Details
Expects a E8Timestamp and a number of months to add.
Returns an updated E8Timestamp.
addQuarters()
• Type
(value: E8Timestamp, quarters: number) => E8Timestamp
• Details
Expects a E8Timestamp and a number of quarters to add.
Returns an updated E8Timestamp.
addSeconds()
• Type
(value: E8Timestamp, seconds: number) => E8Timestamp
• Details
Expects a E8Timestamp and a number of seconds to add.
Returns an updated E8Timestamp.
addWeeks()
• Type
(value: E8Timestamp, weeks: number) => E8Timestamp
• Details
Expects a E8Timestamp and a number of weeks to add.
Returns an updated E8Timestamp.
addYears()
• Type
(value: E8Timestamp, years: number) => E8Timestamp
• Details
Expects a E8Timestamp and a number of years to add.
Returns an updated E8Timestamp.
current()
• Type
() => E8Timestamp
• Details
Returns the current E8Timestamp.
currentTimeZone()
• Type
() => string
• Details
Returns the current environment’s time zone as a string.
date()
• Type
(value: E8Timestamp, timeZone?: string) => E8Date
• Details
Expects a E8Timestamp and an optional time zone.
Returns the E8Date component.
day()
• Type
/** Gets the day component of a timestamp. */
(value: E8Timestamp) => number;
/** Sets the day component of a timestamp. */
(value: E8Timestamp, days: number) => E8Timestamp;
• Details
Expects a E8Timestamp and optionally a number of days to set.
Returns a number when called without the second argument; otherwise returns an updated E8Timestamp.
diff()
• Type
(
value1: E8Timestamp,
value2: E8Timestamp,
unit?: DateUnit | TimeUnit,
precise?: boolean
) => number
• Details
Expects two E8Timestamp values and an optional unit (DateUnit or TimeUnit) (default: 'second'
) and precise flag (default: false
).
Returns the difference between the two timestamps in the specified unit. If precise is false, the result is truncated to an integer.
hour()
• Type
/** Gets the hour component of a timestamp. */
(value: E8Timestamp) => number;
/** Sets the hour component of a timestamp. */
(value: E8Timestamp, hours: number) => E8Timestamp;
• Details
Expects a E8Timestamp and optionally a number of hours to set.
Returns a number when called without the second argument; otherwise returns an updated E8Timestamp.
isValid()
• Type
(value: any) => boolean
• Details
Returns true if the value is a valid E8Timestamp.
minute()
• Type
/** Gets the minute component of a timestamp. */
(value: E8Timestamp) => number;
/** Sets the minute component of a timestamp. */
(value: E8Timestamp, minutes: number) => E8Timestamp;
• Details
Expects a E8Timestamp and optionally a number of minutes to set.
Returns a number when called without the second argument; otherwise returns an updated E8Timestamp.
month()
• Type
/** Gets the month component of a timestamp. */
(value: E8Timestamp) => number;
/** Sets the month component of a timestamp. */
(value: E8Timestamp, months: number) => E8Timestamp;
• Details
Expects a E8Timestamp and optionally a number of months to set.
Returns a number when called without the second argument; otherwise returns an updated E8Timestamp.
parse()
• Type
(
date: E8Date,
time?: E8Time,
timeZone?: string
) => E8Timestamp
• Details
Expects a E8Date, an optional E8Time, and optional time zone.
Returns a E8Timestamp.
second()
• Type
/** Gets the second component of a timestamp. */
(value: E8Timestamp) => number;
/** Sets the second component of a timestamp. */
(value: E8Timestamp, seconds: number) => E8Timestamp;
• Details
Expects a E8Timestamp and optionally a number of seconds to set.
Returns a number when called without the second argument; otherwise returns an updated E8Timestamp.
startOfDay()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the start of the day for the provided E8Timestamp.
startOfMonth()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the start of the month for the provided E8Timestamp.
startOfQuarter()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the start of the quarter for the provided E8Timestamp.
startOfWeek()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the start of the week for the provided E8Timestamp.
startOfYear()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the start of the year for the provided E8Timestamp.
endOfDay()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the end of the day for the provided E8Timestamp.
endOfMonth()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the end of the month for the provided E8Timestamp.
endOfQuarter()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the end of the quarter for the provided E8Timestamp.
endOfWeek()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the end of the week for the provided E8Timestamp.
endOfYear()
• Type
(value: E8Timestamp) => E8Timestamp
• Details
Returns the end of the year for the provided E8Timestamp.
time()
• Type
(value: E8Timestamp, timeZone?: string) => E8Time
• Details
Expects a E8Timestamp and an optional time zone.
Returns the E8Time component.
year()
• Type
/** Gets the year component of a timestamp. */
(value: E8Timestamp) => number;
/** Sets the year component of a timestamp. */
(value: E8Timestamp, years: number) => E8Timestamp;
• Details
Expects a E8Timestamp and optionally a number of years to set.
Returns a number when called without the second argument; otherwise it returns an updated E8Timestamp.