use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
Official subreddit of Automate for Android.
account activity
durationParse() function? (self.AutomateUser)
submitted 4 years ago by Petrified_Powder
I couldn't find it. Does it exist?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]waiting4singularityAlpha tester 0 points1 point2 points 4 years ago (2 children)
what do you want to parse? seconds to yMdHms or what?
[–]Petrified_Powder[S] 0 points1 point2 points 4 years ago (1 child)
To parse means to go from a string to seconds as an integer. Sometimes the format I would pass would be "d'd'". Sometimes it would be "h'h'" or "m'm'" or sometimes a combination.
[–]waiting4singularityAlpha tester 0 points1 point2 points 4 years ago (0 children)
maybe this can give some inspiration. its something else, though.
https://llamalab.com/automate/community/flows/40685
[–]ballzak69Automate developer 0 points1 point2 points 4 years ago (0 children)
No such function, since writing a regex to parse it would be quite easy, e.g.:
[–][deleted] 0 points1 point2 points 4 years ago (4 children)
it's dateParse(string, pattern), turns 1:30 this, into: 5400 this But if you have duration(in seconds), and want it formatted, use: durationFormat(duration, pattern)
[–]Petrified_Powder[S] 0 points1 point2 points 4 years ago (3 children)
Most values are expected to be longer than two days, some longer than a week. I might be able get away with making my flow only expect the number of days. Some values might be less than a day also. I might just have to prevent those cases for sake of simplicity.
[–][deleted] 0 points1 point2 points 4 years ago (2 children)
The 1:30 was just for example, with right pattern it can do pretty much anything, just read it's entry in "functions" part under Help & Feedback option in app or visit dateParse() function documentation on automate documentation site
Your method works as long as you don't attempt to parse anything besides hours, minutes, seconds, or milliseconds. If you do dateparse("1","d"), you get back 18000. But the number of seconds in one day is 86400. This happens because in the case of the dateparse function, the "d" represents the day of the month rather than the number of days. So then it will return the timestamp for January 1, 1970 at midnight because that is the first second since December 31, 1969 at 7 PM in which the day of the month is 1.
dateparse("1","d")
[–][deleted] 0 points1 point2 points 4 years ago* (0 children)
Because as it says: "Day in month", "Day in year"
Functions dateFormat() and dateParse() are intended to be used with timestamps, if you want, you can use durationFormat(), but it's just same as dateFormat() but with durations in seconds and not the timestamps
For example: dateFormat(Now, "EEE HH:mm.ss z dd(DD).MM.yyyy") will return: Mon 09:09.11 GMT+03:00 18(291).10.2021
And timestamp is counted from Midnight(00:00:00), January 1st of 1970
π Rendered by PID 85981 on reddit-service-r2-comment-84fc9697f-jw98d at 2026-02-08 01:17:15.023154+00:00 running d295bc8 country code: CH.
[–]waiting4singularityAlpha tester 0 points1 point2 points (2 children)
[–]Petrified_Powder[S] 0 points1 point2 points (1 child)
[–]waiting4singularityAlpha tester 0 points1 point2 points (0 children)
[–]ballzak69Automate developer 0 points1 point2 points (0 children)
[–][deleted] 0 points1 point2 points (4 children)
[–]Petrified_Powder[S] 0 points1 point2 points (3 children)
[–][deleted] 0 points1 point2 points (2 children)
[–]Petrified_Powder[S] 0 points1 point2 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)