Which method to use in php to generate firebase timestamp, which is equally to firebase.serverValue.timestamp?
I have tried using time()
, apparently it's wrong format.
If you are using Google SDK for (Firebase / Firestore), you can use the following :
use Google\Cloud\Core\Timestamp;
// ....
$stamp = new Timestamp(new DateTime());
Then store $stamp
into database.. so you will get a field similar to this
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