{"action":"created","issue":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/5488","repository_url":"https://api.github.com/repos/rethinkdb/rethinkdb","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/5488/labels{/name}","comments_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/5488/comments","events_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/5488/events","html_url":"https://github.com/rethinkdb/rethinkdb/issues/5488","id":139020674,"number":5488,"title":"RFE: Higher level date difference ReQL function","user":{"login":"gitblit","id":868217,"avatar_url":"https://avatars.githubusercontent.com/u/868217?v=3","gravatar_id":"","url":"https://api.github.com/users/gitblit","html_url":"https://github.com/gitblit","followers_url":"https://api.github.com/users/gitblit/followers","following_url":"https://api.github.com/users/gitblit/following{/other_user}","gists_url":"https://api.github.com/users/gitblit/gists{/gist_id}","starred_url":"https://api.github.com/users/gitblit/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitblit/subscriptions","organizations_url":"https://api.github.com/users/gitblit/orgs","repos_url":"https://api.github.com/users/gitblit/repos","events_url":"https://api.github.com/users/gitblit/events{/privacy}","received_events_url":"https://api.github.com/users/gitblit/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/labels/tp:ReQL_proposal","name":"tp:ReQL_proposal","color":"0052cc"}],"state":"open","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/41","html_url":"https://github.com/rethinkdb/rethinkdb/milestones/subsequent","labels_url":"https://api.github.com/repos/rethinkdb/rethinkdb/milestones/41/labels","id":367201,"number":41,"title":"subsequent","description":"Issues in this milestone will be revisited after each major release during the planning stage for the major release after it. They will be moved to a specific release milestone if chosen for that release.","creator":{"login":"coffeemug","id":48436,"avatar_url":"https://avatars.githubusercontent.com/u/48436?v=3","gravatar_id":"","url":"https://api.github.com/users/coffeemug","html_url":"https://github.com/coffeemug","followers_url":"https://api.github.com/users/coffeemug/followers","following_url":"https://api.github.com/users/coffeemug/following{/other_user}","gists_url":"https://api.github.com/users/coffeemug/gists{/gist_id}","starred_url":"https://api.github.com/users/coffeemug/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/coffeemug/subscriptions","organizations_url":"https://api.github.com/users/coffeemug/orgs","repos_url":"https://api.github.com/users/coffeemug/repos","events_url":"https://api.github.com/users/coffeemug/events{/privacy}","received_events_url":"https://api.github.com/users/coffeemug/received_events","type":"User","site_admin":false},"open_issues":465,"closed_issues":4,"state":"open","created_at":"2013-06-30T07:32:52Z","updated_at":"2016-03-09T02:16:20Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2016-03-07T16:18:17Z","updated_at":"2016-03-09T20:05:30Z","closed_at":null,"body":"> r.time(2016, 1, 1, 'Z').sub(r.time(2015, 1, 1, 'Z'))\r\n\r\nI'm really happy to have the date subtraction capability - because I need it.  :)  But it would be great if I could specify something like:\r\n\r\n    r.diff(r.time(2016, 1, 1, 'Z'), r.time(2015, 1, 1, 'Z'), 'd')\r\n\r\nto get the difference in days.  Right now I have to write this:\r\n\r\n    r.floor(r.time(2016, 1, 1, 'Z').sub(r.time(2015, 1, 1, 'Z'))).div(86400))\r\n\r\nArguably, that is not horrible, but having a smart & flexible date difference function would be quite handy and easier to digest than specifying time constants in the query.\r\n\r\nOur friends at ArangoDB offer a nice DATE_DIFF function.\r\n\r\n> DATE_DIFF(date1, date2, unit, asFloat): Calculate the difference between two dates in given time  unit, optionally with decimal places. Returns a negative value if date1 is greater than / after date2.\r\n>\r\n> unit can be either of the following to specify the time unit to return the difference in (case- insensitive):\r\n>\r\n> y, year, years\r\n> m, month, months\r\n> w, week, weeks\r\n> d, day, days\r\n> h, hour, hours\r\n> i, minute, minutes\r\n> s, second, seconds\r\n> f, millisecond, milliseconds"},"comment":{"url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/comments/194481572","html_url":"https://github.com/rethinkdb/rethinkdb/issues/5488#issuecomment-194481572","issue_url":"https://api.github.com/repos/rethinkdb/rethinkdb/issues/5488","id":194481572,"user":{"login":"marshall007","id":877936,"avatar_url":"https://avatars.githubusercontent.com/u/877936?v=3","gravatar_id":"","url":"https://api.github.com/users/marshall007","html_url":"https://github.com/marshall007","followers_url":"https://api.github.com/users/marshall007/followers","following_url":"https://api.github.com/users/marshall007/following{/other_user}","gists_url":"https://api.github.com/users/marshall007/gists{/gist_id}","starred_url":"https://api.github.com/users/marshall007/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marshall007/subscriptions","organizations_url":"https://api.github.com/users/marshall007/orgs","repos_url":"https://api.github.com/users/marshall007/repos","events_url":"https://api.github.com/users/marshall007/events{/privacy}","received_events_url":"https://api.github.com/users/marshall007/received_events","type":"User","site_admin":false},"created_at":"2016-03-09T20:05:30Z","updated_at":"2016-03-09T20:05:30Z","body":"This is almost identical to my proposal in #4187."}}