All,
I want to send a monthly report basically saying how many months until a date hits.
some meta code, looking for this
| eval timeinmonthsmonths = "1/1/2020" - now()
thanks
-Daniel
hi @daniel333,
Did the either of the answers below solve your problem? If so, please resolve this post by approving it!
If your problem is still not solved, keep us updated so that someone else can help ya. Thanks for posting!
Something like the following may work for you:
<base search>
| eval end_time=strptime("1/1/2020", "%m/%d/%Y")
| eval time_in_days = round((end_time - now()) / 86400, 2)
| table time_in_days
time_in_months can be a little bit harder because of the variable length of days per month.
Hi @daniel333,
Can you try this query?
| makeresults | eval date="2018-12-07" | eval timeinmonthsmonths = ceiling((strptime(date, "%Y-%m-%d") - now())/(3600*24*30.41))
You can remove ceiling
command if you want months in floating point.
Hope this helps!!!