Hello!
I am making a Discord bot on glitch.com and I was trying to convert a Date() function into a Discord hover able timestamp.
I know there are websites that can convert it, but I want to be able to convert it in my code because each timestamp will be different.
This is what I mean by the Discord timestamp.
This is my code:
var user = await Levels.fetch(mentionedMember, interaction.guildId, true);
var lastUpdatedDate = new Date(user.lastUpdated).toLocaleDateString("en-US");
var lastUpdatedTime = new Date(user.lastUpdated).toLocaleTimeString("en-US");
return `<@${user.userID}> is **level ${user.level}** with **${user.xp} xp**. Last updated on ${lastUpdatedDate} at ${lastUpdatedTime} *(PST)*.`
The output is this:
The main reason I want to turn this into a Discord timestamp is so it will automatically adjust to the user’s time zone.
Thank you!