Timestamp string will not be displayed in the 2.0 App

Currently busy with the migration of a Blynk 0.1 based project in Blynk 2.0
Most of the issues could be solved, only one is still to go:

My ESP32 will send timestamp information of an event to the Blynk App by using an String in the format “08.06.2022 14:23:03”
This string will be created in this function:

String localTime() 
  	static char buf[20];                                  
  	static time_t lastsec {0};
  	getLocalTime(&tm, 50);
  	if (tm.tm_sec != lastsec) 
    		lastsec = tm.tm_sec;
    		strftime (buf, sizeof(buf), "%d.%m.%Y %T ", &tm);   
    		//time_t now;
    		time_t now = time(&now);
    		if (!(time(&now) % 43200)) 
    		{  getTime();               
  return buf;

The string was transferred to Blinky 0.1 by using

"Blynk.virtualWrite(V9,localTime()); " 

and can be displayed correctly.
With Blynk 2.0 it will fail, and I cant find the error.
Any hint will be highly appreciated

@sc-6000 Please edit your post, using the pencil icon at the bottom, and add triple backticks at the beginning and end of your code so that it displays correctly.

Triple backticks look like this:


Hi Pete, done

Fail in what way?

What datastream type are you using for V9 ?


no data will be displayed, only the “0”…

I tried “double” and “string” as well, same result

You answered you own question about which data type it should be.

When you’ve fixed that, you could try…



Done, but does not work …

in the marked area there should be the timestamp of the 10ml of agent applied … (Sorry for the lables in german)
Datastream is defined as

ESP32 Codes is …

void dose_PH_Minus()
    Serial.println("Dose Ph- started");
    current_dose_Millis = millis();
    if ( (enable_dose==HIGH)&& (pump_flow==LOW)&&(((unsigned long)(current_dose_Millis - previous_dose_Millis) >= interval_previous_dose)))
      Serial.print("calculate Dose time");
      if (Dose_Time >0)
        Blynk.virtualWrite(V9," ");
        digitalWrite(D23, LOW);
        status_relais_1 = HIGH;
        Serial.println("Relais EIN");
        //digitalWrite(LED, HIGH); // nur für tests, sonst auskommentieren
        previous_single_dose_Millis = current_single_dose_Millis;
      previous_dose_Millis = current_dose_Millis;  


I used


last_time_dose is declared as “String”…

Thanks, Pete, for your support!

1 Like