• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

NTPClient

Q&A Forum › Category: ESP32 › NTPClient
0 Vote Up Vote Down
Peter Kern asked 7 years ago

Hello Ruis,
in https://rntlab.com/module-10/esp32-lora-receiver-part-3/ following two lines are written:

#include <NTPClient.h>
formattedDate = timeClient.getFormattedDate();

I get the following Error: ‘class NTPClient’ has no member named ‘getFormattedDate’
If I replace timeClient.getFormattedDate() with timeClient.getFormattedTime()
there is no Error, but only time.
In the Keywords getFormattedTime is listed, but not getFormattedDate.
Do I need also #include NTPTimeClient.h ?

Thanks for your help
Peter

Question Tags: ESP32, NTPClient.h
8 Answers
0 Vote Up Vote Down
Rui Santos Staff answered 7 years ago

Hello Peter,

You’re using the wrong NTPClient library. Can you please remove your current library and install this NTPClient library forked that also has the date?

https://github.com/taranais/NTPClient

I’m using the library forked by Taranais, because it comes with the date method:

formattedDate = timeClient.getFormattedDate();
0 Vote Up Vote Down
Peter Kern answered 7 years ago

Hello Rui,
I was in France for some time with no access to internet.
Back home I used your solution and it worked. Thanks!
It’s not helpfull for users, if different libraries with the same name exist. A solution may be NTPClient_t (for taranis) and NTPClient_w (for Weinberg), but this is out of our influence.
Thanks again
Peter

0 Vote Up Vote Down
Rui Santos Staff answered 7 years ago

Thanks for letting me know and I’m glad you made it worked! I’ll point anyone having the same problem to this thread.

Regards,
Rui

0 Vote Up Vote Down
Murray Bold answered 7 years ago

Hi Rui
The location https://github.com/taranais/NTPClient library at this location has the Keywords file getFormattedTime is listed, but not getFormattedDate. Has the library been changed or updated.??
Thanks Murray

0 Vote Up Vote Down
Rui Santos Staff answered 7 years ago

@Murray Bold, you need to use the Taranais NTP Client library: https://github.com/taranais/NTPClient

Even though, it doesn’t have the getFormattedDate listed in the keywords file that function is available in that library.

0 Vote Up Vote Down
Murray Bold answered 7 years ago

Thanks .I will try it.

0 Vote Up Vote Down
Jop answered 6 years ago

Hello Rui and other posters Peter and Murray,

At some moment several sketches of me using NTPClient did not compile anymore, where they did this summer.
Luckily I found your blogs.

My sketches did compile in the past. I was not aware that I used the “Taranais-version” of NTPClient, but that should have been so.

I guess the libaries-update utility of the Arduine IDE had overwritten at some moment in the short past the Taranais-version with the Weinberg. So I replaced the Weinberg by the Taranais.

How we can prevent such happen again?

Regards,

Jop

0 Vote Up Vote Down
Rui Santos Staff answered 6 years ago

Hello Jop, I think you probably moved to a new installation or re-installed the other library. I think you could prevent by renaming the library or folder, so it’s not overwritten…

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [New Edition] Build ESP32-CAM Projects eBook – 2nd Edition April 16, 2025
  • [eBook Updated] Learn ESP32 with Arduino IDE eBook – Version 3.2 April 16, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.