-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
truncate
command for dates
#3710
Comments
Currently I can run: > r.now().day()
2
> r.now().month()
2
// etc. I want to be able to do: > r.now().day({prefix: true})
"2015-02-02"
> r.now().month({prefix: true})
"2015-02"
// etc. This would make it easier to group by month or day, whereas right now I would have to construct the group manually and it's enough of a pain to do it that RethinkDB isn't a great tool for such operations. |
Also note, the above is meant to illustrate what I want to do, not to dictate the API. We might want to come up with a different API to do it (for example, do we want to return strings or something else?), but I don't understand dates and times well enough to propose something sensible. |
I'd much rather see a command that allows arbitrary formatting, something like: > r.now().format("YYYY-MM-DD")
"2015-02-02"
> r.now().format("YYYY-MM")
"2015-02" |
|
I really like the One concern I have with it is that whenever I format things like this I always find myself digging through documentation to find a correct string to represent what I want, which always annoys me. It doesn't seem very... conducive to quick and dirty time series grouping queries, though it might be a matter of good docs. |
I think I would prefer a |
Agreed, I think one solution would be to allow passing a "human-readable" unit (i.e. So |
I think that |
@coffeemug asked for this and can maybe give more information.
The text was updated successfully, but these errors were encountered: