I'm looking for a way to store a timezone-aware datetime
object in mongoDB.
I read here: Create an ISODate with pyMongo that storing a datetime
object in MongoDB with pymongo will result in a ISODate
object being stored (or an object that looks like this when querying from the shell)
Using the datetime.replace(tzinfo=[...])
method, there is a way to make the datetime object aware of its timezone. Unfortunately, when storing such object in mongoDB, the timezone information seems to be lost.
My question is: is there a way to store the timezone in the ISODate object itself, so that it looks like something like this: ISODate("2012-07-14T01:00:00+01:00")
when querying the shell and so that the datetime object is still timezone aware when reloaded with pymongo later on?
Thanks a lot for your help!