Sorry if this is simple I did google it
I need to generate a string like this dd:hh:mm to pass to a web page.
(based on ESP32 Web Server using Server-Sent Events (SSE) | Random Nerd Tutorials)
I've tried variations on this, which Serial.print s fine, but I'm getting nonsense on the page.
char statbuff[16];
// upTime=snprintf(statbuff, 16, " %2i: %2i: %2i:\0",ddUp, hhUp, minsUp); // OR
upTime=String(snprintf(statbuff, 16, " %2i: %2i: %2i:\0",ddUp, hhUp, minsUp));
Serial.println(statbuff);
If i do it like this
upTime = String(ddUp) + ":" + String(hhUp) + ":" + String(minsUp);
it works - but doesnt show leading digits (nor allow two spaces) -
so eg 0:0:9 where I'd want 00:00:09
suggestions?
