Difference between two timestamps in elapsed time?

76 views
Skip to first unread message

BurningTreeC

unread,
Jul 27, 2021, 4:12:37 AM7/27/21
to TiddlyWiki

Hi there, tiddlywikians

Let's say I have two timestamps and I want to get the elapsed time from one timestamp to the other, is there a simple way to get this?

I calculate the difference between the timestamps by

<$set name="timestampDiff" value={{{ [<timestamp1>subtract<timestamp2>] }}}>
<<view the elapsed time here in hh:mm:ss>>
</$set>

I would appreciate any help :)

best wishes,
Simon

TW Tones

unread,
Jul 27, 2021, 8:17:14 AM7/27/21
to TiddlyWiki
BTC,

There are a few date range (time within thaT) calculation tools, the first that comes to mind is in Evans Formula plugin, Eric's timer tools may do it for you, I think there is another.
  • If its only today simple maths can be used (separate the hours and minutes) unless it goes over the 00:00
  • Is can be safer to always use a full date serial number to cope with more than one day or aging items.
I will let you know if I recall something else.

Tones

Saq Imtiaz

unread,
Jul 27, 2021, 8:50:59 AM7/27/21
to TiddlyWiki
Hiya BTC,

It occurs to me that the format:relativedate[] operator could be extended. 
It currently calculates the date relative to now and does not accept any parameters. It could be extended to accept a parameter indicating the date to compare to, as well as perhaps a format string. The challenge would be getting the syntax right so it is intuitive to use.
Might be worth creating a github issue or even a PR if you feel up to it.

Regards,
Saq

Reply all
Reply to author
Forward
0 new messages