0

I have a csv formatted with dates fields formatted dd/mm/yyyy. In firestore, I have two important date fields one should be a string and one should be a timestamp.

For the string field, if I try inserting str(date) it will be inserted as yyyy/mm/dd

For the timestamp field, I tried

from dateutil.parser import parse
dateResult = parse(dateString, dayfirst=True)

It inserts as mm/dd/yyyy, I also have a createdAt field which should insert the time now as dd/mm/yyyy

datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S")

but it is also inserted as mm/dd/yyyy

How to force Firestore to store dates either as DateTime, timestamp or stings in the format specified?

Lynob
  • 4,483
  • 12
  • 55
  • 109
  • hi, after looking for a while I found [this](https://stackoverflow.com/questions/53482750/convert-date-to-timestamp-for-storing-into-firebase-firestore-in-javascript#:~:text=you%20can%20simply%20use%20the%20following%20line) post that could help you with the issue that you are facing – Robertocd_98 Aug 09 '21 at 08:58

0 Answers0