如何在Firebase实时数据库中添加日期/时间到日期?-Project Arduino Nano 33物联网 [英] How to add date/time to date in Firebase Realtime Database? - project arduino nano 33 iot
问题描述
我正在做一个关于Arduino nano 33 IoT的项目.我使用"Firebase_Arduino_WiFiNINA.h"库将传感器数据发送到Firebase数据库.我有个问题.当传感器数据发送到数据库时,是否可以在Firebase中添加日期和时间?如果是这样,该怎么做.我是第一次使用Firebase.谢谢您的帮助!
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!
推荐答案
Firebase具有将服务器端时间戳写入服务器的功能.我查看了您使用的 Firebase-Arduino-WiFiNINA 库,我可以说此功能包装在 C_STR_113
中,您可以在
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;
}
这篇关于如何在Firebase实时数据库中添加日期/时间到日期?-Project Arduino Nano 33物联网的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!