Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firestore to automatically create a timestamp field with its own google time

Does firestore have this feature where it will create a timestamp field with their own time when creating a new document... So it wont matter where ever the document has been created from, the time zone will be same for every country because i believe firebase has one time.

like image 818
ibrahimxcool Avatar asked Oct 27 '25 06:10

ibrahimxcool


1 Answers

I think you're looking for Firestore's server timestamp. When you write a field with that value into a document, the Firestore server will expand it to the current time on the server.

If you want to prevent users from writing other values to this field, you can use Firebase's server-side security rules to enforce that the value of the field is equal to the request.time built in variable.

like image 130
Frank van Puffelen Avatar answered Oct 28 '25 20:10

Frank van Puffelen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!