Using Date.now() / 1000:
const timestamp = Math.floor(Date.now() / 1000);
// Use in message
message.channel.send(`<t:${timestamp}:F>`);
From a Discord Message object:
const timestamp = Math.floor(message.createdTimestamp / 1000);
// Use in reply
message.reply(`Message was sent at <t:${timestamp}:F>`);
For a specific date:
const date = new Date('2024-12-31T23:59:59');
const timestamp = Math.floor(date.getTime() / 1000);
// Use in message
message.channel.send(`Event starts at <t:${timestamp}:F>`);
Using Discord.js TimeStamp utility:
const { time } = require('discord.js');
// Format options: t, T, d, D, f, F, R
message.channel.send(`Event starts ${time(date, 'F')}`);
Remember to divide by 1000 to convert from milliseconds to seconds when creating Discord timestamps manually. The Discord.js time utility handles this automatically.