data classification with arduino I want to classify my data from 3 sensors with arduino so that every time i enter the specific date or hour, or also it can be a period of time like 10 days ago, it shows me the exact data. In other word i want to classify my data so that whenever i want every detail of data, i would be able to get it by entering the information of year,date,time. I also didn't want my data to be in separate files and time stamps. I want to be able to do that within one file and search inside that file...

#include "RTClib.h"
#include &lt;SD.h&gt;
#include &lt;SPI.h&gt;

RTC_DS1307 rtc;
const int chipSelect = 10;

File dataFile;

String print_time(DateTime timestamp) {
  char message[120];

  int Year = timestamp.year();
  int Month = timestamp.month();
  int Day = timestamp.day();
  int Hour = timestamp.hour();    
int Minute = timestamp.minute();
      int Second= timestamp.second();

      sprintf(message, "%d-%d-%d %02d:%02d:%02d", Month,Day,Year,Hour,Minute,Second);

      return message;
    }

    void setup(){
      Serial.begin(9600);

      pinMode(chipSelect, OUTPUT);
      if (!SD.begin(chipSelect)){
        Serial.println("Error: SD card would not initiate.");
      }

      rtc.begin();
      if (!rtc.isrunning()){
        Serial.println("Clock is not running");
      }

      dataFile = SD.open("log0.csv", FILE_WRITE);
      if (!dataFile){
        Serial.println("Could not open file.");
      }

    }

    void loop(){
      Datetime now = rtc.now();
      dataFile.println(print_time(now));

      delay(3000);
    }
If you plan to continuously take data at a fixed rate, I suggest you
don't timestamp the individual records. Instead, store the initial
timestamp and the data sampling period in a binary header, followed by
fixed-size binary records. Then, when you want to retrieve the record
for time t, you can fseek() right to

uint32_t offset = header_size
                + record_size * (t - initial_time) / sampling_period;


If there is a slight chance that you may fail to record some data
points, you may want to have a boolean in each record that tells whether
the data is valid. You can then fill the missing data with invalid
records.

If your Arduino is likely to be turned on and off unpredictably, then
timestamping every record may be a better option, but finding a specific
record will likely be very slow.