Class: Timestamp
@sapphire/time-utilities.Timestamp
Timestamp class, parses the pattern once, displays the desired Date or UNIX timestamp with the selected pattern.
Constructors
constructor
• new Timestamp(pattern
)
Starts a new Timestamp and parses the pattern.
Parameters
Name | Type | Description |
---|---|---|
pattern | string | The pattern to parse |
Since
1.0.0
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:40
Properties
pattern
• pattern: string
The raw pattern
Since
1.0.0
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:30
template
• Private
template: any
Since
1.0.0
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts: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
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:90
parse
▪ Private
Static
parse: any
Parses the pattern.
Since
1.0.0
Param
The pattern to parse
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:96
resolveDate
▪ Private
Static
resolveDate: any
Resolves a date.
Since
1.0.0
Param
The time to parse
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:102
Methods
display
▸ display(time?
): string
Display the current date with the current pattern.
Parameters
Name | Type | Description |
---|---|---|
time? | TimeResolvable | The time to display |
Returns
string
Since
1.0.0
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:46
displayUTC
▸ displayUTC(time?
): string
Display the current date utc with the current pattern.
Parameters
Name | Type | Description |
---|---|---|
time? | TimeResolvable | The time to display in utc |
Returns
string
Since
1.0.0
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:52
edit
▸ edit(pattern
): Timestamp
Edits the current pattern.
Parameters
Name | Type | Description |
---|---|---|
pattern | string | The new pattern for this instance |
Returns
Since
1.0.0
Chainable
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:59
toString
▸ toString(): string
Defines the toString behavior of Timestamp.
Returns
string
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:63
displayArbitrary
▸ Static
displayArbitrary(pattern
, time?
): string
Display the current date with the current pattern.
Parameters
Name | Type | Description |
---|---|---|
pattern | string | The pattern to parse |
time? | TimeResolvable | The time to display |
Returns
string
Since
1.0.0
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:70
displayUTCArbitrary
▸ Static
displayUTCArbitrary(pattern
, time?
): string
Display the current date utc with the current pattern.
Parameters
Name | Type | Description |
---|---|---|
pattern | string | The pattern to parse |
time? | TimeResolvable | The time to display |
Returns
string
Since
1.0.0
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:77
utc
▸ Static
utc(time?
): Date
Creates a UTC Date object to work with.
Parameters
Name | Type | Description |
---|---|---|
time? | string | number | Date | The date to convert to utc |
Returns
Since
1.0.0
Defined in
node_modules/@sapphire/timestamp/dist/index.d.ts:83