-1
I am developing an application with esp32 (similar to Arduino) that gets date and time from an NTP server. Use the following function to display these values:
void printLocalTime()
{
struct tm timeinfo;
if(!getLocalTime(&timeinfo)){
Serial.println("Falha ao obter hora");
return;
}
Serial.println(&timeinfo, "%A, %B, %d %Y %H:%M:%S");
}
I can get (display) the values normally, but I want to store them in a variable, but I don’t know how to access them inside the struct timeinfo, someone can help me?
Use timeinfo(dot) and the name of the value of the struct you want to access, the data of this struct are in the link: http://www.cplusplus.com/reference/ctime/tm/ Example: timeinfo.tm_sec
– Daniel Mendes
Thank you very much!
– Ricardo Coutinho