Discord.js specific timestep for code block

enter image description here

How can I make such a time format?

Sample code I made.

.setDescription(`📆 Your account was opened on ${moment(member.user.createdAt).startOf('day').fromNow()}.`)

I want to learn how to show the date of account establishment and server joining as in the image.

>Solution :

Discord will convert any text in the format of <t:SECONDS> into a timestamp. Just replace SECONDS with the seconds since 12:00 am on January 1st, 1970 UTC (also known as the UNIX Epoch). Try this code:

.setDescription(`📆 Your account was opened on <t:${moment(member.user.createdAt).unix()}>.`)

Note that the .unix() method in moment.js will return the seconds since the UNIX Epoch.

You can also check out this website and play around with it to get the other formats, but in every format, the number you need is always the seconds since UNIX Epoch.

Leave a Reply