Comments on: ESP8266 NodeMCU NTP Client-Server: Get Date and Time (Arduino IDE) https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Thu, 01 May 2025 21:31:27 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: HankB https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-1033042 Thu, 01 May 2025 21:31:27 +0000 https://randomnerdtutorials.com/?p=95190#comment-1033042 In reply to Clive.

timeClient.update() need not be called every time the application needs time. As you suggested, every hour or so (I’m guessing) should be sufficient to correct the internal clock. When I use my pfSense router as the NTP server, it ignores requests more frequent that 1/minute.

]]>
By: Henry D https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-953191 Mon, 02 Sep 2024 02:38:58 +0000 https://randomnerdtutorials.com/?p=95190#comment-953191 Hello Sara

I am following your examples and am receiving epoch time. Is there a way to get epoch time out to milliseconds? I am loading data into a firebase database and using an android app to display. The android time stamp/epoch time is out to milliseconds (13 characters).

]]>
By: Michail https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-952039 Wed, 28 Aug 2024 05:45:11 +0000 https://randomnerdtutorials.com/?p=95190#comment-952039 In reply to Richie.

Your Board version was likely around 2.4.2. If you upgrade to 2.5.0, you will pass that problem, but still likely to have Wifi issues. So, you have to upgrade to 2.5.2 or newer.

]]>
By: DEM https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-946008 Wed, 07 Aug 2024 06:12:19 +0000 https://randomnerdtutorials.com/?p=95190#comment-946008 Hi
How check latest update from server ?, if internet Connection is lost.
will try, to check
Serial.print(timeClient.forceUpdate());
Serial.print(timeClient.update());
but every time >> timeClient.update() is 0

when it connect with internet >> timeClient.forceUpdate() is 1 and if loss connection its print 0

any other way to chack latest update from server ?

after lost internet connection time will be continues updated, not understand why ?
Serial.println(timeClient.getFormattedTime());

]]>
By: Tian https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-922237 Thu, 06 Jun 2024 19:41:33 +0000 https://randomnerdtutorials.com/?p=95190#comment-922237 I solved the incorrect year problem by introducing a new library.

#include <TimeLib.h> // Time Library
unsigned long epochTime = timeClient.getEpochTime();
int currentYear = year(epochTime);

In this way, no more false information will appear.

]]>
By: Mehmet İbrahim https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-912293 Fri, 03 May 2024 20:44:39 +0000 https://randomnerdtutorials.com/?p=95190#comment-912293 In reply to Geert.

Take a look at this library. Is calculate according to the date you give with getCurrentDate.
github.com/buelowp/sunset

]]>
By: Za https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-895274 Wed, 28 Feb 2024 11:36:06 +0000 https://randomnerdtutorials.com/?p=95190#comment-895274 In reply to Dragos Chelan.

Not everybody wants what you want – can anybody else assist me with a RTC backup?

]]>
By: Sara Santos https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-889517 Fri, 09 Feb 2024 12:25:08 +0000 https://randomnerdtutorials.com/?p=95190#comment-889517 In reply to indrajit.

The 1970 is when it cannot get time from the internet and will use the start of epoch time.
Add an if statement checking the year. If it’s 1970, try to get time again.
Regards,
Sara

]]>
By: indrajit https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-888223 Mon, 05 Feb 2024 10:33:26 +0000 https://randomnerdtutorials.com/?p=95190#comment-888223 Can someone help me to fix the 1970 year issues, with Board library version and ntp client version..

]]>
By: Henry D https://randomnerdtutorials.com/esp8266-nodemcu-date-time-ntp-client-server-arduino/#comment-854522 Thu, 10 Aug 2023 18:52:23 +0000 https://randomnerdtutorials.com/?p=95190#comment-854522 In reply to Ogursoft.

Thank you

]]>