AQL has officially supported date_diff function
We’re glad to announce that we have supported a more convenient way for you all to find the duration between 2 date fields.
Let’s imagine you’re working for an ecommerce company and you want to find out How long a user hasn’t placed an order, you would need to subtract 2 dates (Current Time and the Last time that Customer made the Order).
You just need to simply use the date_diff()
function for that types of calculation
date_diff('day', max(orders.created_at), @(now))
With this function, you can find the duration between any 2 date fields
date_diff(<Interval>, <Date 1>, <Date 2>)
Feel free to reach out if you have any questions.