SD filename as date?

lbernstone
Posts: 826
Joined: Mon Jul 22, 2019 3:20 pm

Re: SD filename as date?

Postby lbernstone » Wed Apr 08, 2020 10:46 pm

Code: Select all

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

cagdas
Posts: 1
Joined: Thu Oct 15, 2020 4:09 pm

Re: SD filename as date?

Postby cagdas » Thu Oct 15, 2020 4:13 pm

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

Who is online

Users browsing this forum: Google [Bot], guillaumesene and 33 guests