0

So currently messagecreatedAt gets the timezone from the ip, in my case GMT+0200 (Central European Summer Time), I want it to get BST timezone but not sure how. I have been told that I could use

Date#toDateString(): Wed Jan 01 2020
Date#toISOString(): 2020-01-01T00:00:00.000Z
Date#toLocaleDateString(): 1/1/2020
Date#toLocaleString(): 1/1/2020, 12:00:00 AM
Date#toLocaleTimeString(): 12:00:00 AM
Date#toString(): Wed Jan 01 2020 00:00:00 GMT+0000 (Coordinated Universal Time)
Date#toTimeString(): 00:00:00 GMT+0000 (Coordinated Universal Time)
Date#toUTCString(): 00:00:00 GMT+0000 (Coordinated Universal Time)

or https://www.npmjs.com/package/date-fns but I am not sure how to put it into my code:

const messageContent = new MessageEmbed()
  .setColor('#cc5500')
  .setURL(message.url)
  .setAuthor(message.author.tag, message.author.avatarURL({ format: 'png', dynamic: true }))
  .setTitle('Message Content')
  .addField('Author', `${message.author}`)
  .addField('Time', `${message.createdAt}`)
  .addField('Server', `${message.guild.name}`)
  .addField('Channel', `<#${message.channel.id}>  #${message.channel.name}`)
  .setDescription(message.content)
  .setFooter(`Message ID: ${message.id}`)
  .setTimestamp();

try {
  client.users.cache.get('256916902939590656').send(messageContent);
} catch (err) {
  message.channel.send('No logs channel found. Please make sure I have access to it and make sure the channel name is called logs');
}
Mr. Polywhirl
  • 35,562
  • 12
  • 75
  • 123
  • 5
    This question is an issue of `Date`'s, not DiscordJS. This is a duplicate of [How to initialize a JavaScript Date to a particular time zone](https://stackoverflow.com/a/15171030/12101554) – Samathingamajig Jul 19 '21 at 16:19

0 Answers0