The result looks like: 16:53:4 this.
The problem I have: After splitting the data into colums I set the preferences of the time colum from "Standard" to "Time" (Format: HH:MM:SS)
The problem is, I save the time like this: HH:MM:S so excel can only translate the 4s of my example if it would save like :04 and not :4
How can I change this? Hopefully you guys get what I mean
regards
Bastian
Edit: Would this work?
if (now.hour(),DEC < 10) {
logfile.print("0"); }
logfile.print(now.hour(), DEC);
logfile.print(":");
if (now.minute(),DEC < 10) {
logfile.print("0"); }
logfile.print(now.minute(), DEC);
logfile.print(":");
if (now.second(),DEC < 10) {
logfile.print("0"); }
logfile.print(now.second(), DEC);
man1ac:
The result looks like: 16:53:4 this.
The problem I have: After splitting the data into colums I set the preferences of the time colum from "Standard" to "Time" (Format: HH:MM:SS)
The problem is, I save the time like this: HH:MM:S so excel can only translate the 4s of my example if it would save like :04 and not :4
How can I change this? Hopefully you guys get what I mean
It's a bit garbled but I understand your problem is one of leading zeros. I don't believe this is an Arduino problem, it is an Excel problem. Once the column is properly formatted, Excel sorts out your ragged input.
i.e. all the time stuff in one column, and Office 2000 supplies the zeros as required. This in the same way as, when I enter year, I enter "16" and it gets changed to "2016".
You can see that Cattledog has a leading zero inserted on condition of single digit numbers but this is only needed for dumb stuff like the serial monitor, or a graphic display.
I would use cattledog's solution in reply #3 to get the correct data format. Next I would read the file that is written to the SD card with a text editor to verify the data. It should have the format that you specified in the code.
If that is like '04:33:05', excel will properly use it as a time (4:33:05 AM) and display 4:33:05 in the cell (on my system, Excel2013). What you see might depend on the default settings of your PC or Excel; I never care. If the removal of that leading zero in '04' is an issue, you can format the cell properly.
The best way to display the data literally is by opening excel and using data import; make sure to select 'text' for the field type and not 'general'.
That most certainly does NOT do what you seem to think it does. 10 will never be less than 10. (If that doesn't make sense, google the comma operator, which you are abusing.)
man1ac:
So can you maybe help me an tell me how to formatt the data in excel?
The pic below is so obvious I'm not sure it can be that enlightening. I think your answer lies in reply #8. I did not realise your code was not kosher, as I don't use that method.