Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

120
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!