in Mongodocs, it is said that datetimes with specified "Z" timezone at the end are saved as "UTC" datetime format.. https://docs.mongodb.com/manual/reference/method/Date/
I created some sample time data in Python:
now=str((datetime.datetime.now()).isoformat())+'Z'
then=str((datetime.datetime.utcnow()+datetime.timedelta(0,one_week_in_seconds)).isoformat())+'Z'
I used datetime.now() and datetime.utcnow() and appended 'Z' on both... this is what I get:
'now': '2018-07-10T11:06:05.512484Z',
'then': '2018-07-17T09:06:05.512484Z',
I am now using MEAN stack with Node/Express and mongoose (ODM) Driver to make my schema models in the database. When I push the data via some router middleware to my mongoDB Database, the two fields have mongoose "Date" format. However, for both fields it creates an ISODate time format...:
"now" : ISODate("2018-07-10T09:02:01.410Z"),
"then" : ISODate("2018-07-17T09:02:01.410Z"),
I think thats a bug, normally, if "Z" is specified, it should create the specified time in ISO-Format, which it is here, but as I have created the time in local-time format and appended a "Z" in the first case ("now"), the time should be saved as 'now' : ISODate("2018-07-10T11:06:05.512484Z")
without modifying /
converting from local to UTC time or not?