Hi!
I'm getting the date & time from a DS1307 based module using the RTClib library.
I want to convert the returned value(s) to a string in the format YYYYMMDDHHMiSS. Before I reinvent the wheel has anyone else already done this and would care to share?
Cheers
David
Take a look at sprintf().
It uses a char array (string), to store the data rather than the String object, but it's really more advisable to use that anyway.
Hi Arrch,
Unless your using something specific to RTClib then consider using this another library GitHub - davidhbrown/RealTimeClockDS1307: Yet another DS1307 Real-Time Clock library for Arduino (obsolete) as it has a 'getFormatted2k' to return a YYYYMMDDHHNNSS string.