SimpleTime.ino question

mikekgr
Posts: 8
Joined: Tue Feb 14, 2017 11:06 am

SimpleTime.ino question

Postby mikekgr » Fri Aug 09, 2019 12:06 pm

Dear Sirsm
I am making my first steps in ESP32 running with the Arduino IDE. I found an example that using the time.h internal library, you can have ntp time. The example is: SimpleTime.ino
My problem is I can not understood one commant that this SimpleTime.ino is using, more precicely:

Code: Select all

[void printLocalTime()
{
  struct tm timeinfo;
  if(!getLocalTime(&timeinfo)){
    Serial.println("Failed to obtain time");
    return;
  }
  Serial.println(&timeinfo, "%A, %B %d %Y %H:%M:%S");
}/code]
while in setup section there is:
[code]
configTime(gmtOffset_sec, daylightOffset_sec, ntpServer);
What it does the part of the Serial.println (&timeinfo, "%A, %B %d %Y %H:%M:%S") ? From where are getting the %A %B etc ?
Looking at the time.h there are not these references %A %B etc etc.

Please for someone that can help me to understand...

Thanks and Best Regards,
Mike Kranidis

mikekgr
Posts: 8
Joined: Tue Feb 14, 2017 11:06 am

Re: SimpleTime.ino question

Postby mikekgr » Fri Aug 09, 2019 7:23 pm

to answer to my question, please look at the below link:
http://zetcode.com/articles/cdatetime/
that in the paragraph: Formatting time, explain all the "strange" formating parameters that I asked the help for...

Best Regards,
Mike Kranidis

Who is online

Users browsing this forum: No registered users and 45 guests