Page 2 of 2

Re: SD filename as date?

Posted: Wed Apr 08, 2020 10:46 pm
by lbernstone

Code: Select all

    struct tm now;
    getLocalTime(&now, 0);
    char filename[64];
    strftime(filename, 64, "/%F.csv", &now);

Re: SD filename as date?

Posted: Thu Oct 15, 2020 4:13 pm
by cagdas
ilioss wrote:
Tue Apr 07, 2020 6:06 pm
Hello pipi61

I just tested the filename inlcuding the / slash and IT WORKS.
I,am realy exited.
See my program snippets;

[code// Write the sensor readings on the SD card
void logSDCard() {
dataPath = String(dayStamp);
String dataPatha = "/"+ dataPath + ".csv";
String path = dataPatha;
dataMessage = String(readingID) + "," + String(dayStamp) + "," + String(timeStamp) + "," +
String(temperature) + "\r\n";
writeFile(SD, dataPath.c_str(), dataMessage.c_str());
Serial.print("Save data: ");
Serial.println(dataMessage);
appendFile(SD, path.c_str(), dataMessage.c_str());
}][/code]
I'm using DS1302 with virtuabotixRTC library, how can i get these String(dayStamp) + "," + String(timeStamp) timestamps?
thanks for your help