Aggregation for number of days since X

Hi,

I have a bunch of data and each element has a timestamp field. What I'm wanting to do is get the median for the number of days since that datestamp for all that data (preferably in days)

I can get the data out fine, but it's the number of days since I'm having problems with, are there any time based options for aggregations in Elasticsearch for a query like this?