-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
ValueError datetime #68
Comments
I think the first 2 should probably work as expected with the existing DateTimeField, but the last should probably be given its own "DateField" a-la django (and maybe a TimeField as well for times). Thanks for reporting |
Is it possible to cast them to a DateTime with 0's? That's sorta what I'd expect to happen. I'm coming from Ruby, and Sequel or the Ruby SQLite adapter appears to do be doing this. I also added that the field is defined as a peewee DateTimeField(). |
Totally, if the DateTimeField encounters something like example 3 it should zero out the times. |
Great! |
Thanks for fixing :) |
Would be really good if we could pass in the format string into the field constructor. I have dates in a sqlite db of '9 January 2009' so I'd like to pass the format in: transaction_date = DateField(format='%d %B %Y') I'll fork and suggest something.... |
Thanks for suggesting this fix, I've added it here: |
here's the commit: 0d9708a the way it works is you can pass in "formats" kwarg in the field constructor containing a list of various formats to try. |
Legend Charles - you beat me to it :) Love Peewee btw - its my ORM of choice. In fact I don't choose any Thanks for the rapid help. Ben On Mon, May 14, 2012 at 5:30 PM, Charles Leifer
Ben Hughes |
No problem, glad to hear you're liking peewee! |
I have an SQLite database which has a DateTimeField() with a few different datetime formats (not on purpose). I will probably fix my datetime values, but I thought I'd post this in case you feel peewee should handle this gracefully?
2011-11-15 21:53:59.759451+0000
2011-11-28 20:12:03
2009-01-01 (error)
http://paste.pocoo.org/show/aH7tITRfn9mhczxgWq3u/
Thanks for Peewee (and Flask-Peewee)!
The text was updated successfully, but these errors were encountered: