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

Date and Datetime should handle unix timestamps #33

Open
todofixthis opened this issue Oct 26, 2017 · 0 comments
Open

Date and Datetime should handle unix timestamps #33

todofixthis opened this issue Oct 26, 2017 · 0 comments

Comments

@todofixthis
Copy link
Contributor

todofixthis commented Oct 26, 2017

If Date or Datetime detects that the incoming value is an int or float, it should interpret the value as a unix timestamp.

Note that this does not apply if the incoming value is a string, even if it looks like a unix timestamp.

Examples:

>>> f.Datetime().apply(1508882922)
datetime.datetime(2017, 10, 25, 11, 8, 42, tzinfo=<UTC>)

>>> f.Datetime().apply(1508882922.333)
datetime.datetime(2017, 10, 25, 11, 8, 42, 333000, tzinfo=<UTC>)

>>> f.Date().apply(1508882922)
datetime.date(2017, 10, 25)

>>> f.Datetime().apply('1508882922')
FilterError: This value does not appear to be a datetime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant