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

122
Vistas
how I can get hours range from timestamp?

I have two timestamps from and To of working hours.

In this case From is: [today] 09:00 (24h) - To: [today] 18:00 (24h).

I would like to get the hours from 0:00 to From-hour and from To to last day hour.

I need to know the "non-working" hours to disable these hours in my calendar.

So I can disable in my calendar like this:

Disable: 00:00 to 09:00

Disable: 18:00 to 23:59

How can I get the hours from the beginning of the day to the first hour of From and from the To hour to the end of the day?

Is this doable with javascript?

var from = 1633935600;
var to = 1633968000;

var f_1 = new Date(from * 1000).getHours();
var t_1 = new Date(to * 1000).getHours();

console.log(f_1);
console.log(t_1);

Thanks.

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can get the outside hour length by subtracting f_1 from t_1:

var from = 1633935600;
var to = 1633968000;

var f_1 = new Date(from * 1000).getHours();
var t_1 = new Date(to * 1000).getHours();

let outsideHourDuration = t_1 - f_1;

console.log('outside hour start:', f_1)
console.log('outside hour end:', f_1 + outsideHourDuration)

about 4 years ago · Juan Pablo Isaza 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