Mathematica has powerful date, time and timeseries functions and options. Yet they all seem to be tightly tied to Time in global clock-calendar-astronomic perception.

I need to do basic time-duration arithmetic and plotting for media clips..

For example: I have sequence of video clips:

v01 = 25m14s
v02 = 2h23m00s
v03 = 1h    

v01and02 = v01 + v02
videostotalTime = v01 + v02 +v03


help: I cannot find simple syntax for this in Mathematica

How to format and add/subtract/multiply my data in SIMPLEST most legible manner to give me totals, sub-totals, duration offsets, lists etc?

I tried

v01 = TimeObject[{0,25,14}]
v02 = TimeObject[{2,23,00}]
v01 + v02 is what I want <<< but does not give me duration sum.

I have been looking in docs and googling, but am missing basic keywords/concept

thank you

  • $\begingroup$ here is how red-lang does it red-by-example.org/#timexex $\endgroup$ – nomadics Jul 21 '17 at 14:10
  • $\begingroup$ Try Quantity[MixedMagnitude[{25, 14}], MixedUnit[{"Minutes", "Seconds"}]] $\endgroup$ – Kuba Jul 21 '17 at 14:25
  • $\begingroup$ Can you just use Quantity? I.e. v01 = Quantity[25, "Minutes"] + Quantity[14, "Seconds"] $\endgroup$ – KraZug Jul 21 '17 at 14:25
  • $\begingroup$ thanks^ ... I really want a much more concise syntax :: easier to read and write, not just for me, but for interop workflow chain others <p> $\endgroup$ – nomadics Jul 27 '17 at 13:39
  • $\begingroup$ ..and for other people {who are unfamiliar with mathematica}. I spent a few days digging into red-lang [v nice but new-- see red-by-example.org/#timexex]. Then dug into emacs orgmode which is mature and does all the math right -- and inside tables. stackoverflow.com/questions/17679867/… orgmode.org/manual/Durations-and-time-values.html >> model orgmode, then hope to emulate in Mathematica $\endgroup$ – nomadics Jul 27 '17 at 13:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.