Reputation: 33
Are there any built-in functions to find out the number of days between timestamps, add days, or find number of months between timestamps? Currently I'm storing dates in my documents as strings.
For example, if I do:
return (DATE_TIMESTAMP("2014-2-1") - DATE_TIMESTAMP("2014-1-1")) / 86400000
I receive:
[
31
]
which is the correct number of days that I'm looking for. Just wanted to check and see if there are any built-in functions or is there any plan to add them.
Upvotes: 3
Views: 625
Reputation: 9097
I can confirm that there currently is no built-in function to calculate the number of days or months between two given dates or timestamps. I am not aware of any plans to add such functions soon, so it's best to calculate the differences like in your above code or, for anything more complex, a user-defined function.
Upvotes: 2