Ok, that solved it for me. I ended up using a rule action to collect the dates and then another rule action to format the variable in a human readable format.
I’m trying to do something similar, but with the hour and minute. So I’ve tried the below Action, but it sets the time incorrectly, at least for me. Do I need to add something for the time zone?
EDIT: So I’m thinking I need to subtract -14400 from the time stamp as it is retrieved. I just can’t seem to make it work in this expression…
FURTHER EXPLAINATION: What I’m trying to do is have the current time when the weather data is pulled. As an alternative, is it easier to somehow capture the time that the rule actually ran? That might be close enough.
It’s based on the timezone set for your location, so I would make sure that’s correct.
I would also try displaying more details in the formatted date for troubleshooting. (See the help article I linked above). I would also start by using a generic formatDate(TimeZone) so you get the raw ISO formatted time output to make sure you’re supplying a valid value.
Also, it’s not clear what the input value to your rule was as clearly the example shown in your $owTimeStamp expression is different than the input used in the Epoch timestamp converter as the times aren’t even close (not just a timezone issue, but clearly the minutes aren’t the same either, so it seems to be a different input value).
Keep in mind that the time formatting requires millisecond values whereas many APIs will respond with Unix timestamps which are in seconds. If you are getting a unix timestamp, you’ll need to make sure to multiple it by 1000 to get the relevant milliseconds for your input.
I’ve tried to put this all in 1 neat expression but get an invalid expression result. Is this too much for 1 expression?
EDIT: I also added 5 second delays between setting variables because it seems sometimes it calculated the previous variable instead of the one being pulled. Not sure if that is possible though.
EDIT 2: Thanks for the help Josh.
This did it… much trial and error!!