It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
Sometimes I have a need to add (or substract) two (or more) times, each one described as a string of hh:mm:ss.msec. I've already tried to search the web for some time calculators but all my findings were quite restricted (for example: no seconds/miliseconds or no hours, no possibility to copy/paste such time strings).
avatar
Lexor: Sometimes I have a need to add (or substract) two (or more) times, each one described as a string of hh:mm:ss.msec. I've already tried to search the web for some time calculators but all my findings were quite restricted (for example: no seconds/miliseconds or no hours, no possibility to copy/paste such time strings).
Try WolframAlpha. But you'll have to specify that you want your answer in milliseconds. Edit: or not. When I subtracted it didn't provide an answer in the same format, but when I used addition, it did. shrug
Post edited April 19, 2023 by InkPanther
According to the docs, Frink might be able to do it.

https://frinklang.org/#DateTimeHandling
https://frinklang.org/fsp/frink.fsp
avatar
InkPanther: Try WolframAlpha. But you'll have to specify that you want your answer in milliseconds. Edit: or not. When I subtracted it didn't provide an answer in the same format, but when I used addition, it did. shrug
Quite interesting tool, but it seems I will need to combine two answers because one has the answer as hours (only) and the other (in full format hh:mm:ss.msec) has hours converted to days if the result has more hours than 24.
avatar
Lexor:
Oh well... It's worse than I thought.

Maybe these will be more convenient:
http://www.unitarium.com/time-calculator
https://datetimecalculator.net/time-calculator
Could you code it?
Post edited April 19, 2023 by EverNightX
avatar
VanishedOne: According to the docs, Frink might be able to do it.

https://frinklang.org/#DateTimeHandling
https://frinklang.org/fsp/frink.fsp
I've tried to use it but I'm confused how it does work. :D

Example: how to add 40:30:20.10 and 4:03:02.01? I've tried:

# 40:30:20.10 # + # 4:03:02.01 #

Expected result: 44:33:22.11 but I've got this:

Can't parse date 40:30:20.10
#40:30:20.10#AD 2023-04-19 AM 04:03:02.001 (Wed) Mountain Daylight Time

:?
Post edited April 19, 2023 by Lexor
avatar
Lexor: Sometimes I have a need to add (or substract) two (or more) times, each one described as a string of hh:mm:ss.msec. I've already tried to search the web for some time calculators but all my findings were quite restricted (for example: no seconds/miliseconds or no hours, no possibility to copy/paste such time strings).
OK This can be done easily in a spreadsheet like LibreOffice "Calc" I assume Excel can as well. Just format the cells as the correct time format. Place the 2 values in separate cells and then in the cell you want the answer write: =A2-A3

Assuming cells A2 and A3 had your values.
Post edited April 19, 2023 by EverNightX
avatar
EverNightX: Could you code it?
What do you mean?
avatar
EverNightX: OK This can be done easily in a spreadsheet like LibreOffice "Calc" I assume Excel can as well.
I need a website calculator, not an application. :)
avatar
EverNightX: Could you code it?
avatar
Lexor: What do you mean?
avatar
EverNightX: OK This can be done easily in a spreadsheet like LibreOffice "Calc" I assume Excel can as well.
avatar
Lexor: I need a website calculator, not an application. :)
Not sure why. But isn't there online versions of excel, google docs etc?
Post edited April 19, 2023 by EverNightX
avatar
EverNightX: Not sure why.
I can access the same website on many different devices.

avatar
EverNightX: But isn't there online versions of excel, google docs etc?
Not without registration.
Hello Lexor!

I would suggest to prepare your own calculation tool for your purpose.

As I understand, you want the total numeric sum or difference between time strings and NOT the 24-hour-cycle time stamp as a result.

Coding it yourself in Matlab, Scilab, Mathcad or even (MS) Excel, I would do the following:


1.) First step:
Transform your time string(s) individually in their total amounts represented of your least unit (in your example: milliseconds [ms])

[ms] = (baseline figure)
[ss] in millisec = ss*1000
[mm] in millisec = mm*60000
[hh] in millisec = hh*3600000

=> time string in millisec = hh*3600000 + mm*60000 + ss*1000 + ms


2.) Second step:
Perform your desired operation (add or subtract) on two or more transformed time strings:

=> resulting sum (or difference) in millisec = time string A in millisec + (or -) time string B in millisec


3.) Third step:
Transform the resulting sum or difference in millisec back to your desired time string format:

time string "hh:mm:ss:ms" to be constructed again of:
=> hh = integer value greater Zero of ( result in millisec / 3600000 )
remaining decimal rest for next time unit calculation:
=> hh_decimal_rest = result in millisec / 3600000 - integer( result in millisec / 3600000 )

=> mm = integer value greater Zero of ( hh_decimal_rest * 60 )
remaining decimal rest for next time unit calculation:
=> mm_decimal_rest = hh_decimal_rest * 60 - integer( hh_decimal_rest * 60 )

=> ss = integer value greater Zero of ( mm_decimal_rest * 60 )
remaining decimal rest for next time unit calculation:
=> ss_decimal_rest = mm_decimal_rest * 60 - integer( mm_decimal_rest * 60 )

=> ms = ss_decimal_rest * 1000

=> recomposition of the time string:
hh:mm:ss:ms


Kind regards,
foxgog
avatar
Lexor: Not without registration.
I'm cooking dinner at the moment. If you don't have a solution when I finish I'll make you a webpage that can do it this evening.
Post edited April 19, 2023 by EverNightX
avatar
InkPanther: Oh well... It's worse than I thought.
One more note about WolframAlpha: the thing to combine two answers (hours and the rest) would not be that bad, but it seems WolframAlpha has some problems with 1/1000s of second. :/

40:30:20.10+4:03:02.01 gives 44:33:22.11 and that's correct. But:

40:30:20.101+4:03:02.011 gives (again) 44:33:22.11 (instead of 44:33:22.112) :/
avatar
InkPanther: Maybe these will be more convenient:
http://www.unitarium.com/time-calculator
40:30:20.10+4:03:02.01 gives 44:33:22.11000000002 wtf? :D

40:30:20.100+4:03:02.010 gives again 44:33:22.11000000002

But 40:30:20.101+4:03:02.010 gives 44:33:22.111 - weird :D It's the most precise so far but I can't copy/paste here, and I've noticed that miliseconds need to be always typed as "ddd" because if I enter only "dd" then it adds zero at the start (0dd) not at the end (dd0) so I'll need to be cautious. :)

All in all, thank you for all your suggestions, they are much better than my own findings. :)
Post edited April 19, 2023 by Lexor
avatar
foxgog: Hello Lexor!

I would suggest to prepare your own calculation tool for your purpose.
Hey foxgog. :) I already have some tools to calculate if I'm at my workplace (including my own windows *.bat) but I'm looking for website to be able to do such calculations at any time and on any device I have access to.