I am developing a web-based application to capture start time and end time from system date-time but my main problem is that I don't know how can I get the duration time, between start and end time for downtime.
//Function to get current start time var startTime = setInterval(function () { start() }, 1000); function start() { var startDate = new Date(); var timeStart = startDate.toLocaleTimeString(); $("#setCount").html(timeStart); }
Duration is how long something lasts, from beginning to end. A duration might be long, such as the duration of a lecture series, or short, as the duration of a party. The noun duration has come to mean the length of time one thing takes to be completed.
Another simple technique to calculate the duration between two times in Excel is using the TEXT function: Calculate hours between two times: =TEXT(B2-A2, "h") Return hours and minutes between 2 times: =TEXT(B2-A2, "h:mm") Return hours, minutes and seconds between 2 times: =TEXT(B2-A2, "h:mm:ss")
Duration is defined as the length of time that something lasts. When a film lasts for two hours, this is an example of a time when the film has a two hour duration. An amount of time or a particular time interval. A measurement of a bond's price sensitivity to changes in interest rates.
Do you mean this:
var date1 = new Date(); var date2 = new Date(); var diff = date2 - date1; //milliseconds interval
upd
check JSFiddle
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With