How can I convert seconds to time?

998 views
Skip to first unread message

Dalibor Čarapić

unread,
Nov 9, 2012, 6:08:17 AM11/9/12
to tas...@googlegroups.com
I need to display the current display timeout in the user friendly maner as a time.
So if the timeout is 30 I would display "00:30" (or "00:00:30"). If the timeout is 10 minutes I would show "00:10:00".
I have seen that there is a convert seconds to date function but this does not give me the desired result.
I suppose I could do this manually if Tasker supports the "MOD" mathematical function (I do not know if it does). But I was wondering if there is an easier solution?

Pent

unread,
Nov 9, 2012, 6:15:28 AM11/9/12
to Tasker
Convert seconds to Time Date with Variable Convert, then split with
Variable Split to get the time.

Pent

Pent

unread,
Nov 9, 2012, 6:16:11 AM11/9/12
to Tasker
Ah sorry, you can get the current seconds with

Variable Set, %secs, %TIMES % 60

i.e. remainder after dividing time by 60.

Pent

Dalibor Čarapić

unread,
Nov 9, 2012, 7:35:07 AM11/9/12
to tas...@googlegroups.com
Thank you. Is there a way to easily then pad the values with zeroes? With maths I can get something like 1:30 (minute and thirty seconds) or 1:5 (minute and five seconds) and I would like it to be 01:30, 01:05.

Pent

unread,
Nov 9, 2012, 9:12:27 AM11/9/12
to Tasker
> Thank you. Is there a way to easily then pad the values with zeroes? With

Regular expression (Variable Search Replace action) or Variable Split,
then test if it's < 10.

Pent

Dalibor Čarapić

unread,
Nov 9, 2012, 9:20:43 AM11/9/12
to tas...@googlegroups.com
I've managed to make it work. Thank you.
--
Dalibor Čarapić
Message has been deleted

PiBorg

unread,
Dec 11, 2018, 3:10:03 PM12/11/18
to Tasker
Even if the thread is older, is it possible to show/describe the exact implementation? For me as a beginner the solution is unfortunately not comprehensible. I would be very happy about your help. Thanks and greetings
---

Duck Redbeard

unread,
Dec 11, 2018, 8:30:43 PM12/11/18
to Tasker
How are you wanting this to be displayed? (Notification, toast, widget on screen?)

What do you want displayed? (Screen timeout in seconds, how many seconds you've been alive, time since last cup of coffee?)

We can clarify the task if you clarify what you want Tasker to do.

PiBorg

unread,
Dec 11, 2018, 10:55:46 PM12/11/18
to Tasker
I have created a project with which a VPN connection is established or disconnected. The connection will be started or stopped in a Toogle Task. If the connection is successful the profile VPNConnected is started and if you don't need the connection anymore the profile is terminated.

Now I want to record two things in a log file:

1) Start: In the format MM:SS, how long did the connection setup take.

2) End: In format HH:MM:SS, how long you were connected.

The start of the time measurement for the connection establishment should start in my imagination in the toggle task and be terminated in the input task of VPNConnected. The time how long one was actually connected would also be started via the toggle task and measured via the output task of VPNConnected.

Duck Redbeard

unread,
Dec 12, 2018, 9:20:16 AM12/12/18
to Tasker

Sla Z3

unread,
Dec 19, 2018, 4:11:49 PM12/19/18
to tas...@googlegroups.com
Sorry for the late feedback.  The stopwatch is a very good starting point.  Thank you very much for your feedback and the provision of the task.

Best regards

Am Mi., 12. Dez. 2018, 15:20 hat Duck Redbeard <duckre...@gmail.com> geschrieben:
--
You received this message because you are subscribed to the Google Groups "Tasker" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tasker+un...@googlegroups.com.
Visit this group at https://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages