Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

351
Visualizações
How to get the the createdAt timestamp without 'GMT+0000 (Coordinated Universal Time)'?

I have searched everywhere for this but I haven't got the right answer. I just want to set it without the CUT time.

{name: "Registered:", value: `${user.createdAt}`},
    
{name: "Joined:", value: `${message.guild.joinedAt}`}

It currently shows up like this: click here to see.

Is there any way to remove it?

about 4 years ago · Juan Pablo Isaza
2 Respostas
Responde à pergunta

0

Assuming the properties are JS Date instances, you can use one of these functions to do it:

function formatDateV1 (date) {
  return date.toLocaleString(undefined, {dateStyle: 'medium', timeStyle: 'medium', hour12: false});
}

function formatDateV2 (date) {
  return `${date.toDateString()} ${date.toTimeString().slice(0, 8)}`;
}

const date = new Date();
const user = {createdAt: date};
const message = {guild: {joinedAt: date}};

const registerV1 = {name: "Registered:", value: formatDateV1(user.createdAt)};
console.log('registerV1', registerV1);

const joinV1 = {name: "Joined:", value: formatDateV1(message.guild.joinedAt)};
console.log('joinV1', joinV1);

const registerV2 = {name: "Registered:", value: formatDateV2(user.createdAt)}
console.log('registerV2', registerV2);

const joinV2 = {name: "Joined:", value: formatDateV2(message.guild.joinedAt)}
console.log('joinV2', joinV2);

about 4 years ago · Juan Pablo Isaza Relatório

0

Yes it's possible to remove it

   {name: "Registered:", value: `${user.createdAt.toDateString()}`},
        
   {name: "Joined:", value: `${message.guild.joinedAt.toDateString()}`}

You should to add toDateString() to avoid the GMT or CUT time

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda