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

124
Visualizações
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 Respostas
Responde à pergunta

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 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