Skip to main content

Calculate Timetime difference in Windows batch file

How can I get the difference between totwo times in a Batch file? Because I want to print it in aan HTML file.

I thought this iswould be possible, but it isn't:.

Set "tijd=%time%"
echo %tijd%
echo %time%-%tijd%

Results:

11:07:48,85
11:16:58,99-11:07:48,85

But what I want is:

00:09:10,14

Or 9 minminutes and 10 seconds or 550 seconds

Calculate Time difference in Windows batch file

How can I get the difference between to times in a Batch file? Because I want to print it in a HTML file.

I thought this is possible, but it isn't:

Set "tijd=%time%"
echo %tijd%
echo %time%-%tijd%

Results:

11:07:48,85
11:16:58,99-11:07:48,85

But what I want is:

00:09:10,14

Or 9 min 10 seconds or 550 seconds

Calculate time difference in Windows batch file

How can I get the difference between two times in a Batch file? Because I want to print it in an HTML file.

I thought this would be possible, but it isn't.

Set "tijd=%time%"
echo %tijd%
echo %time%-%tijd%

Results:

11:07:48,85
11:16:58,99-11:07:48,85

But what I want is:

00:09:10,14

Or 9 minutes and 10 seconds or 550 seconds

Better to explicit that this is relative to a *windows* batch file on the title
Link

Calculate Time difference in Windows batch file

Source Link
Danny Gloudemans
  • 2.7k
  • 7
  • 42
  • 59

Calculate Time difference in batch file

How can I get the difference between to times in a Batch file? Because I want to print it in a HTML file.

I thought this is possible, but it isn't:

Set "tijd=%time%"
echo %tijd%
echo %time%-%tijd%

Results:

11:07:48,85
11:16:58,99-11:07:48,85

But what I want is:

00:09:10,14

Or 9 min 10 seconds or 550 seconds