I am trying to convert a firestore timestamp into milliseconds or a date format using python to perform a calculation using this date. Trying to parse it to date returns.
TypeError: strptime() argument 1 must be str, not DatetimeWithNanoseconds.
How can I convert a Firestore timestamp into milliseconds/date format in python? I need this to perform a calculation.
docs = db.collection(u'status').stream()
for doc in docs:
doc_data = doc.to_dict()
# TypeError: strptime() argument 1 must be str, not DatetimeWithNanoseconds
utc_time = datetime.strptime(doc_data['start_date'], "%Y-%m-%dT%H:%M:%S.%fZ")
It turns out that DatetimeWithNanoseconds inherits from datetime.datetime already
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With