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

273
Visualizações
I have the following code about the current date and time so, how do I add day in current time?
<script>
var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();    
var time = today.getHours() + ":" + today.getMinutes() + ":" + today.getSeconds();
var dateTime = date+' '+time;
</script>
over 4 years ago · Santiago Trujillo
3 Respostas
Responde à pergunta

0

Try this:

tomorrow = new Date(today.getTime() + 1000 * 60 * 60 * 24)

One day equals 24h = 24 * 60 minutes = 24 * 60 * 60 seconds = 24 * 60 * 60 * 1000 miliseconds

Edit: I might have misunderstood the question, but if what you want to achieve is adding 1 day to your variable, this will work. 😄

over 4 years ago · Santiago Trujillo Relatório

0

You can use toLocaleString() Date method to get that format

let actualDate = new Date().toLocaleString();           // Output: d/m/yyyy h:mm:ss
console.log(actualDate)

over 4 years ago · Santiago Trujillo Relatório

0

If you’re looking for the day of the week, then today.getDay() will return a numerical day of the week from 0-6. You could then use an array with the day names in to refer to the text for the day of the week.

For example:

var days = [“Monday”, “Tuesday”, “Wednesday”, “Thursday”, “Friday”, “Saturday”, “Sunday”];

var today = new Date();
var date = today.getFullYear()+'-'+(today.getMonth()+1)+’-‘+today.getDate()+’-‘+days[today.getDay()];
over 4 years ago · Santiago Trujillo 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