Skip to main content

Class: Timestamp

Timestamp class, parses the pattern once, displays the desired Date or UNIX timestamp with the selected pattern.

Constructors

new Timestamp()

new Timestamp(pattern: string): Timestamp

Starts a new Timestamp and parses the pattern.

Parameters

ParameterTypeDescription
patternstringThe pattern to parse

Returns

Timestamp

Since

1.0.0

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:40

Properties

pattern

pattern: string

The raw pattern

Since

1.0.0

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:30


template

private template: any

Since

1.0.0

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:34


display

private static display: any

Display the current date with the current pattern.

Since

1.0.0

Param

The pattern to parse

Param

The time to display

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:90


parse

private static parse: any

Parses the pattern.

Since

1.0.0

Param

The pattern to parse

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:96


resolveDate

private static resolveDate: any

Resolves a date.

Since

1.0.0

Param

The time to parse

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:102

Methods

display()

display(time?: TimeResolvable): string

Display the current date with the current pattern.

Parameters

ParameterTypeDescription
time?TimeResolvableThe time to display

Returns

string

Since

1.0.0

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:46


displayUTC()

displayUTC(time?: TimeResolvable): string

Display the current date utc with the current pattern.

Parameters

ParameterTypeDescription
time?TimeResolvableThe time to display in utc

Returns

string

Since

1.0.0

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:52


edit()

edit(pattern: string): this

Edits the current pattern.

Parameters

ParameterTypeDescription
patternstringThe new pattern for this instance

Returns

this

Since

1.0.0

Chainable

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:59


toString()

toString(): string

Defines the toString behavior of Timestamp.

Returns

string

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:63


displayArbitrary()

static displayArbitrary(pattern: string, time?: TimeResolvable): string

Display the current date with the current pattern.

Parameters

ParameterTypeDescription
patternstringThe pattern to parse
time?TimeResolvableThe time to display

Returns

string

Since

1.0.0

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:70


displayUTCArbitrary()

static displayUTCArbitrary(pattern: string, time?: TimeResolvable): string

Display the current date utc with the current pattern.

Parameters

ParameterTypeDescription
patternstringThe pattern to parse
time?TimeResolvableThe time to display

Returns

string

Since

1.0.0

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:77


utc()

static utc(time?: string | number | Date): Date

Creates a UTC Date object to work with.

Parameters

ParameterTypeDescription
time?string | number | DateThe date to convert to utc

Returns

Date

Since

1.0.0

Source

node_modules/@sapphire/timestamp/dist/esm/index.d.mts:83