I’m starting a project where I want to have custom file names based on the date I pull from an RTC.
The examples all show how to set in already in the format MM-DD-YYYY but I’m interested in just using each part as part of a file name for the qwiic openlog. Ex. SEP28_21.txt for the file name.
I’m looking through the library but I’m not really sure what I’m looking at.
maybe?
uint8_t getMonth();
but I think that only updates the month and doesn’t have a string function?
getMonth() returns the current month as a number (1-12). You can use that with getYear() and getDate() to create the filename. You’ll also need an array of month names to index with getMonth()-1. Then you can format all that (try snprintf) into your filename.
Another option would be to create a struct tm from the RTC data and pass that to strftime(). Something like…