time in 12 hour format?

470 views
Skip to first unread message

Michael Whitney

unread,
Oct 22, 2013, 7:44:58 PM10/22/13
to tas...@googlegroups.com
I have recently managed to get autovoice continuous to work. I have got my phone to turn on the flash light if i say certain commands. I now want to use autovoice and utter to tell me the time when i ask it. Obviously i could look at the phone but would be good for the fun of it and also if my phone isn't near me i can ask what the time is. Also want to do it as its relatively simple but means i'm still learning from it. I have got it to work however it says "00.10". How to i change this to 12 hour format? I tried downloading the talking clock profile from the wiki but this says "time is 10 past 00" and won't read in 12 hour format. How do i do this? 

Bob Hansen

unread,
Oct 22, 2013, 8:19:48 PM10/22/13
to tas...@googlegroups.com
You can do it like this:

%mytime = 00.10
Variable Set %mytime To %mytime + 12  If %mytime < 1 
Variable Set %mytime To %mytime -12  If %mytime > 12.99
Variable Search Replace %mytime Search . Replace Matchs :  <== search for '.' and replace with ':'

Will result in %mytime containing 12:10 and taskers say command will properly say the time.
This does not add am or pm, which is doable but a little more involved.

Rich D

unread,
Oct 22, 2013, 9:03:40 PM10/22/13
to tas...@googlegroups.com

Or....  you can just run this shell command..

date +"%I.%M.%p"

This will give you

10.05.pm

It does not appear to need root...

You can change the delimiter to ":" if you like

Other options can be found here..

http://unixhelp.ed.ac.uk/CGI/man-cgi?date

On Oct 22, 2013 7:45 PM, "Michael Whitney" <mike3...@gmail.com> wrote:
I have recently managed to get autovoice continuous to work. I have got my phone to turn on the flash light if i say certain commands. I now want to use autovoice and utter to tell me the time when i ask it. Obviously i could look at the phone but would be good for the fun of it and also if my phone isn't near me i can ask what the time is. Also want to do it as its relatively simple but means i'm still learning from it. I have got it to work however it says "00.10". How to i change this to 12 hour format? I tried downloading the talking clock profile from the wiki but this says "time is 10 past 00" and won't read in 12 hour format. How do i do this? 

--
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 http://groups.google.com/group/tasker.
For more options, visit https://groups.google.com/groups/opt_out.
Message has been deleted
Message has been deleted

John W.

unread,
Oct 22, 2013, 11:07:55 PM10/22/13
to tas...@googlegroups.com
Here's a quick and dirty way of getting colon and a/p (and is prob fastest):

        A1: Variable Set [ Name:%time To:%TIMES Do Maths:Off Append:Off ]
        A2: Variable Convert [ Name:%time Function:Seconds to Long Date Time Store Result In: ]
        A3: Variable Search Replace [ Variable:%time Search:^.*\d{4}\s{1}0?(.*)m Ignore Case:Off Multi-Line:Off One Match Only:Off Store Matches In: Replace Matches:On Replace With:$1 ]
Reply all
Reply to author
Forward
0 new messages