SD Module - Writing timestamp to txt file & data from sensors

If you can print data to serial or display, you can print it to file

Serial.println(data);
lcd.print(data);
myFile.println(data);

Below are snippets to change filename at midnight

char filename[] = "00000000.CSV";
File myFile;
    GetClock();
    getFileName();


void loop() {

  GetClock();
  if (today != day)
  {
   today = day;
   getFileName(); 
  dailyheader();
  }

void getFileName(){
sprintf(filename, "%02d%02d%02d.csv", year, month, day);
}