I'm writing a sensor data log in a SD Card to use it in a Excel spreadsheet afterwards, and one of the info is the current time.
To convert the date time from Unix format to Excel format I use the known formula that for a Unix Timestamp equal to 1462420139 I get 42495.15902! However these are the results in Arduino:
// Excel conversion formula // Excel Timestamp = (Unix Timestamp / 86400) + 25569 String excelTime = String(now.unixtime() / 86400 + 25569); // Result = 42495 Serial.println(excelTime); excelTime = String((float)now.unixtime() / 86400.00000 + 25569.00000); // Result = 42495.16 Serial.println(excelTime);
How to get all five decimal places and not only 2 to import in Excel?