Setting Date/Time from a TXT file on the SD Card...?

I'm new to Arduino and esp32 programming (read: 'mostly cutting and pasting at this point') and have been looking for a way to set the date and time using a TXT file on the SD card... can anyone assist?

The end result is to save a picture with the date/time attached to the filename and the device (esp32-cam) will be standalone, ie, No internet access.

  • Yours, Fred.

It sounds like, read a file with a time stamp, attach the time to an image, save it back to the same card. Is this correct?

If so, why can't you already associate the time on the card with the file that you saved, since the time stamp file is already there? Then all you really need to do is save an image file.

If not, please clarify with a lot more detail.

I wish to create a text file, in which I'll have the date and time in the following format:


example: 2020,08,16,17,34,00

I wish to parse the text (positions based upon the delimiter (comma) ) , convert text to integers and then assign each one to a variable (year, month, day etc) - and using this - set the date/time on the esp32

I could do this quite easily in php but c+ is new to me.

The device will be left for weeks - possibly months at a time - and all I wish to do is replace the SD Card (with a new datetime.txt file that I can create on the spot), change the batteries and reset the device.

Have you looked at the SD library?