I could not find it in @EricShulman 's great “All about time” colection yet…
Did I miss it or did anyone else build something to do this…
And while I am at this: How can I calculate the count of full minutes to a fixed time?
Best wishes Jan
I could not find it in @EricShulman 's great “All about time” colection yet…
Did I miss it or did anyone else build something to do this…
And while I am at this: How can I calculate the count of full minutes to a fixed time?
Best wishes Jan
The recent addition of unix time and the ability to convert it back to a tiddlywiki timestamp lets you perform maths of times and days, as unix time is numerical, you just need to convert whatever you are adding or subtracting into an appropriate number, then you can add them. I have not yet done this to teach you but I am confident it can be done.
Hi @TW_Tones for the first two tasks I would like to have a relative solution.
Is there a filter for the rest after a division?
There is a lot online about the use of a unix date to do date and time maths. Most of the operations you need are in TiddlyWiki now. It remains easier to add or subtract a “period” (eg; hours/days) from a date to find a new date. It is a little more involved if you want to get the period between two dates.
In short this is a great area for collaboration and shared code to simplify date maths and display, I may not be abe to contribute more for a few days, but will.
3667 seconds are:
Hours: [[3667]divide[[3600]floor[0]]
Minutes: [[3667]remainder[3600]divide[60]floor[0]]
Seconds: [[3667]remainder[60]]
Best wishes Jan
This seems like a place where the new functions might actually be helpful
\function to-seconds(hours, minutes, seconds) [<hours>multiply[3600]] [<minutes>multiply[60]] [<seconds>] +[sum[]]
\function to-hours(seconds) [<seconds>divide[3600]floor[]] [<seconds>remainder[3600]divide[60]floor[]] [<seconds>remainder[60]] +[join[:]]
<<to-seconds 2 40 35>>
<<to-hours 9635>>
<$text text={{{ [function[to-seconds],[1],[15],[0]] }}} />
<$text text={{{ [function[to-hours],[4500]] }}} />
Here is the result of the work that triggered the question: A pie-timer that allows to set and visualize a countdown. As poined out by @TW_Tones below, it depends on @EricShulman 's timeout.js which I need so often, that I would like to have it in the core.
$ _plugins_JJ_classroom_widgets_PieTimer.json (5.9 KB)
Thanks to all helpers and cheers!strong text
@JanJo thanks for sharing. I notice it has a dependancy the action timeout widget but also it would be complete if we can also select 0
from the value drop down.