extract the month, day, hour, minute from current time

Post your questions and help other users.

Moderator: Martin

Post Reply
srjohn
Posts: 17
Joined: 11 Jan 2014 15:53

extract the month, day, hour, minute from current time

Post by srjohn » 15 Jan 2014 00:56

I have a variable now=getDate()
For example time now is "2014-01-15 21:35:46"
How do I extract the month, day, hour, minute to seperate variables?
For example month=01, day=15, hour=21, minute=35.

Can any one help?
Thanks!
-srjohn

srjohn
Posts: 17
Joined: 11 Jan 2014 15:53

Re: extract the month, day, hour, minute from current time

Post by srjohn » 15 Jan 2014 13:37

I can use {triggertime,dateformat,HH:mm:ss} as the displayed text in notification.
For example it shows "21:30:30"
I want to save "21:30:30" as a variable.
So I create a script.

Code: Select all

myTime={triggertime,dateformat,HH:mm:ss}
But Automagic reported error while executing the script.
Is there anything wrong?
Thanks,
-srjohn

User avatar
MURTUMA
Posts: 697
Joined: 05 Mar 2013 22:43

Re: extract the month, day, hour, minute from current time

Post by MURTUMA » 15 Jan 2014 14:05

Look at the script action in this flow. It's not exactly what you want but it should help you forward.

http://automagic4android.com/flow.php?i ... 64b688391a

srjohn
Posts: 17
Joined: 11 Jan 2014 15:53

Re: extract the month, day, hour, minute from current time

Post by srjohn » 15 Jan 2014 16:23

MURTUMA wrote:Look at the script action in this flow. It's not exactly what you want but it should help you forward.

http://automagic4android.com/flow.php?i ... 64b688391a
Thanks for the hints!

Martin!
Posts: 31
Joined: 26 Oct 2013 18:00

Re: extract the month, day, hour, minute from current time

Post by Martin! » 15 Jan 2014 20:28

srjohn wrote:I can use {triggertime,dateformat,HH:mm:ss} as the displayed text in notification.
For example it shows "21:30:30"
I want to save "21:30:30" as a variable.
So I create a script.

Code: Select all

myTime={triggertime,dateformat,HH:mm:ss}
But Automagic reported error while executing the script.
Is there anything wrong?
Thanks,
-srjohn
I think the problem with your code is that you forgot the quotation marks:

Code: Select all

myTime="{triggertime,dateformat,HH:mm:ss}"

srjohn
Posts: 17
Joined: 11 Jan 2014 15:53

Re: extract the month, day, hour, minute from current time

Post by srjohn » 18 Jan 2014 05:11

Martin, thanks!
It is working now!
-srjohn

Post Reply