'ObjectId' object has no attribute 'getTimeStamp'
this answer is python and Django based.
Before using generation_time
be aware that generation_time
will be converted to UTC(Universal Time) which might be ahead or behind depending on your current timezone, so you might see a difference in time if you are using your Local Time in your project settings to save timestamps on your objects. For me, there is a difference of 5.5 hours. So adjust the time according to your timezone.
Example:
For ObjectId('5c51aca67c76124020edbbaf')
the actuall creation time of this object was datetime.datetime(2019, 1, 30, 19, 24, 28, 73000)
but when i geneted its time using generation_time
it is 5.5 hours behind.
In [10]: from bson import ObjectId
In [11]: ObjectId('5c51aca67c76124020edbbaf').generation_time
Out[11]: datetime.datetime(2019, 1, 30, 13, 54, 46, tzinfo=<bson.tz_util.FixedOffset object at 0x102461128>)
Where'd you see getTimeStamp()
as a method?
According to the docs it should just be:
video['date'] = video['_id'].generation_time