Skip to content
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

Idea: accept \DateTime on insertion #117

Open
thijsw opened this issue Dec 23, 2015 · 1 comment
Open

Idea: accept \DateTime on insertion #117

thijsw opened this issue Dec 23, 2015 · 1 comment

Comments

@thijsw
Copy link

thijsw commented Dec 23, 2015

Hi,

First and foremost, thanks for making this client :)

As a suggestion, I would propose an idea that will make the insertion of dates to the database a bit easer (at least for me).

I'd like to be able to save \DateTime instances such that the dates are stored in the native manner, just like with \r\now(), handle by the client. Another option to make this easier would be to include a static method in r\Queries\Dates\Time, e.g. fromDateTime that accepts a \DateTime and yields a new Time object, that can be used for insertion.

Maybe this is already possible and I am missing something, but I couldn't find any information about in the docs.

Any ideas?

@danielmewes
Copy link
Owner

Hi @thijsw . Sorry for my late response. This should already be working. It's just not documented right now.

If you run r\expr(new \DateTime(...))->run($conn) you should get another \DateTime object back, despite it being sent to the server first.

Let me know if there are any issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants