NTPClient library missing Date function

For whatever value this may have to others who may need this ...

I recently was requested to add texts based on certain times of the day to my current project. I had no idea how difficult this was going to be.

After much research I came across several tutorials - mostly ESP8288 / 32 based - that made calls to 'getFormattedTime()' AND 'getFormattedDate()' from a timeAPI. The 'getFormattedDate()' never worked so I looked at the NTPClient.h file and sure enough, 'getFormattedDate()' did not exist.

After researching further, I came across a github chat discussing this very topic. Long story short, at the very bottom of this webpage someone posted a link to a NTPClient library that contained the 'getFormattedDate() function.

While skeptical, I did download it and am glad I did. I have since thoroughly tested this library and it does provide the date.

Thanks.

on which Microcontroller do you want to use NTP?

For the ESP8266/ESP32 you don't need an external library. NTP is included in the ESP cores / time.h

See either the examples in the IDE or smaller examples on my pages
https://werner.rothschopf.net/202011_arduino_esp8266_ntp_en.htm

https://werner.rothschopf.net/microcontroller/202103_arduino_esp32_ntp_en.htm

formating the date can be done with https://cplusplus.com/reference/ctime/strftime/

1 Like

Thank you for your comments and links.

Sorry for the confusion - I was merely passing on a link to an NTPClient.h library that included 'getFormattedDate()' that is not in the library of the same name that can be included in Arduino sketches via the Arduino IDE.

I have been using this 'hacked' library for several days and it works flawlessly.

Thanks again for your help.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.