Skip to content

Instantly share code, notes, and snippets.

View Dog's full-sized avatar

Dog

  • Seattle, WA
View GitHub Profile
@Dog
Dog / gist:272225a5b22a393d2088
Last active May 4, 2024 05:48
Converting between Javascript date and Python datetime with bson
from bson.tz_util import utc
from datetime import datetime, timedelta
# This file is to impliment date related helper functions
#
# This is mainly needed because bson uses the javascript date class.
# The javascript Date() class represents timestamps in milliseconds.
# For some documentation on how Bson, Json, and Date work together, refer to:
# http://blog.mongohq.com/from-json-to-bson-and-back/
#