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

How to work with date type? #7

Closed
benvindo opened this issue Jun 5, 2018 · 1 comment
Closed

How to work with date type? #7

benvindo opened this issue Jun 5, 2018 · 1 comment

Comments

@benvindo
Copy link

benvindo commented Jun 5, 2018

Hi, someone gives me example, how can I use the date type to save and load with minidb?

@thp
Copy link
Owner

thp commented Jun 10, 2018

You should be able to use datetime.datetime, datetime.date and datetime.time, as these all have converters already pre-defined.

import datetime

class Something(minidb.Model):
    name = str
    birthday = datetime.date
    favorite_time_of_day = datetime.time
    last_login = datetime.datetime

The definitions are here:
https://github.com/thp/minidb/blob/master/minidb.py#L781
https://github.com/thp/minidb/blob/master/minidb.py#L797
https://github.com/thp/minidb/blob/master/minidb.py#L811

@thp thp closed this as completed in 71352aa Jun 10, 2018
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