Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

272
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar

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 Denunciar

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda