I need to call an API and it uses millis for its date range based on Unix.
What I want to date is call the API now to get data, then pull data for the same time range but 1 week ago.
What I am just struggling to do is automate the system to get the "now" time in milliseconds.
Has anyone got any ideas?
Hi @Terry Dance, you might try something like this:
{{#now}}toMillis{{/}}
An example rule with this entry:
Will result in this Audit log entry:
TimK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Great. Thanks for accepting the answer.
TimK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've then tried to take away 60 minutes from the time your answer gives using
{{#=}}{{starttime}} - 3600000{{/}}
but it spits out "1.730282217675E12"
Any ideas on that?
It does record the start time correct as "1730285817675"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Terry Dance, this wasn't easy to solve. Let us try another approach. Please try this:
{{now.withYear(1970).withDayOfYear(1).withHour(0).withMinute(0).withSecond(0).withMillis(0).diff(now).millis.minus(3600000)}}
Messy, I know. But it seems to work per your requirements as I understand.
I don't know why ".millis" doesn't works as wanted directly with "now".
TimK
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.