jpiotr42
jpiotr42

Reputation: 1

How to add date/time to date in Firebase Realtime Database? - project arduino nano 33 iot

I'm doing a project on Arduino nano 33 IoT. I use the "Firebase_Arduino_WiFiNINA.h" library to send sensor data to the Firebase database. I have a question. Is it possible to add the date and time in Firebase when the data from sensors was sent to the database? If so, how to do it. I'm using Firebase for the first time. Thank you for any help!

Upvotes: 0

Views: 1700

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 599866

Firebase has a feature to write a server-side timestamp to the server. I looked at the Firebase-Arduino-WiFiNINA library that you use, and as far as I can tell this functionality is wrapped in C_STR_113, which you can see used in this example:

bool Firebase_Arduino_WiFiNINA::pushTimestamp(FirebaseData &dataObj, const String &path)
{
  char *buf = getPGMString(C_STR_113);
  bool flag = sendRequest(dataObj, path.c_str(), FirebaseMethod::POST, FirebaseDataType::TIMESTAMP, buf);
  delPtr(buf);
  return flag;
}

Upvotes: 1

Related Questions