Skip to content
nutmeg edited this page Feb 22, 2023 · 6 revisions

Run Down

Discord+PS has built in unix and embed times that you can use in messages to show things like relative times as well as others
For more info on message timestamps you can look here

Time Types

There are two types of times those being:

  • Now
  • Set

Now

Now is a class called with PSClient.time.now and it represents the current time
This is the code if you want to look through it:

now = new class {
	get embed() { return new Date().toISOString(); }
	get default() { return `<t:${Math.round(new Date().getTime() / 1000)}>` }
	get shortTime() { return `<t:${Math.round(new Date().getTime() / 1000)}:t>` }
	get longTime() { return `<t:${Math.round(new Date().getTime() / 1000)}:T>` }
	get shortDate() { return `<t:${Math.round(new Date().getTime() / 1000)}:d>` }
	get longDate() { return `<t:${Math.round(new Date().getTime() / 1000)}:D>` }
	get shortDT() { return `<t:${Math.round(new Date().getTime() / 1000)}:f>` }
	get longDT() { return `<t:${Math.round(new Date().getTime() / 1000)}:F>` }
	get relative() { return `<t:${Math.round(new Date().getTime() / 1000)}:R>` }
}

Set

Set is a class called with PSClient.time.set and it represents a set (given) time
This is the code if you want to look through it:

set = new class {
	embed(date) { return new Date(date).toISOString(); }
	default(date) { return `<t:${Math.round(new Date(date).getTime() / 1000)}>` }
	shortTime(date) { return `<t:${Math.round(new Date(date).getTime() / 1000)}:t>` }
	longTime(date) { return `<t:${Math.round(new Date(date).getTime() / 1000)}:T>` }
	shortDate(date) { return `<t:${Math.round(new Date(date).getTime() / 1000)}:d>` }
	longDate(date) { return `<t:${Math.round(new Date(date).getTime() / 1000)}:D>` }
	shortDT(date) { return `<t:${Math.round(new Date(date).getTime() / 1000)}:f>` }
	longDT(date) { return `<t:${Math.round(new Date(date).getTime() / 1000)}:F>` }
	relative(date) { return `<t:${Math.round(new Date(date).getTime() / 1000)}:R>` }
}

Message Times

Let's say we want to make a message say the relative time from when the message was sent to now, we can do that with this:

{
    timestamp: PSClient.time.now.relative
}

Alternatively let's say we want to make a message that says the relative time from from a set date like 11/28/2018 to now, we can do that with this:

{
    timestamp: PSClient.time.set.relative("11/28/2018")
}

Embed Times

Let's say we want to make an embed's timestamp the current time, we can do that with this:

{
    timestamp: PSClient.time.now.embed
}

Alternatively let's say we want to make an embed's timestamp a set date like 11/28/2018, we can also do that with this:

{
    timestamp: PSClient.time.set.embed("11/28/2018")
}
Clone this wiki locally