Well, googling didn't do much to help me here and I'm shocked that something I can do in two lines of code in C#
DateTime dateTime;
string text = dateTime.ToLongDateString();
is this difficult for Arduino, but how do you get a string version of a date time stamp?
I want the current date and time as a string in this format
May 4, 2016 17:15:33
Since I can't use any of the C++ includes, like ctime, I'm not sure how to accomplish this.
-
I found a great library for this very purpose! github.com/PaulStoffregen/Timedinotom– dinotom2016年05月05日 00:21:57 +00:00Commented May 5, 2016 at 0:21
-
But I can't get any of the examples to work on an Unodinotom– dinotom2016年05月05日 00:32:44 +00:00Commented May 5, 2016 at 0:32
-
3Which examples did you try? What results did you get?SoreDakeNoKoto– SoreDakeNoKoto2016年05月05日 01:58:23 +00:00Commented May 5, 2016 at 1:58
-
1What time do you want to get? The Arduino has no concept of the time, unless you add an RTC module, and then it is down to whatever library the RTC module uses.Majenko– Majenko2016年05月05日 08:46:07 +00:00Commented May 5, 2016 at 8:46
-
I wasn't aware of that. So an additional hardware piece(RTC) is required to capture time? I'll look into thatdinotom– dinotom2016年05月05日 08:53:57 +00:00Commented May 5, 2016 at 8:53
1 Answer 1
You need additional hardware like a RTC for example an DS1307 or on the other hand an arduino/shield with ethernet or wifi so you could get the time by NTP another option might be DCF77 time via the air - sorry forgot GPS could also be used to get the time .... the rest then should be simple creating a string.