I am doing that in a temperature logger. This is with the SdFat library.
Assuming you know the time (as in the variables below):
unsigned int year;
byte month, day, hour, minute, second;
//This function returns the date and time for SD card file access and modify time.
void fileDateTime (uint16_t* date, uint16_t* time)
*date=FAT_DATE(year, month, day);
*time=FAT_TIME(hour, minute, second);
} // end of fileDateTime
void setup ()
// Attach callback function to provide date time to files.
Now when the SdFat library wants to know the date and time it calls fileDateTime. At this point those variables should have the correct time in them (read your clock chip at that point if you have to).