J
J
jizzy2020-09-04 18:00:12
JavaScript
jizzy, 2020-09-04 18:00:12

JS how to calculate date/month/day and convert it all to hours?

Hi all! Help me please! I need to calculate the total time and display the result in hours as a number ( Should be 80 hours ). We need endDate to subtract startDate and get the result like this: result = 80;

var startDate = "2020-09-04T11:38:22.283Z";
    var endDate = "2020-09-18T11:38:00.000Z";

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2020-09-04
@jizzy

(new Date(endDate).getTime() - new Date(startDate).getTime()) / 1000 / 60 / 60

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question