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

In Windows 7 64bit, mktime out of range for both examples #721

Closed
fivejjs opened this issue Jul 7, 2016 · 2 comments
Closed

In Windows 7 64bit, mktime out of range for both examples #721

fivejjs opened this issue Jul 7, 2016 · 2 comments

Comments

@fivejjs
Copy link

fivejjs commented Jul 7, 2016

modify utils.py with the following snippet. It works.

def json_int_dttm_ser(obj):
    """json serializer that deals with dates"""
    val = base_json_conv(obj)
    if val is not None:
        return val
    if isinstance(obj, datetime):
        epoch = datetime(1900, 1, 1)
        #obj = int(time.mktime(obj.timetuple())) * 1000
        diff = obj - epoch
        obj = int(diff.days * 24 * 3600 + diff.seconds) * 1000

    else:
        raise TypeError(
             "Unserializable object {} of type {}".format(obj, type(obj))
        )

    return obj
@xrmx
Copy link
Contributor

xrmx commented Jul 7, 2016

@fivejjs care to open a pull request with an explanation please?

@mistercrunch
Copy link
Member

#756

zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 17, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 24, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 25, 2021
zhaoyongjie pushed a commit to zhaoyongjie/incubator-superset that referenced this issue Nov 26, 2021
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

3 participants