CopyDateToStringMMDDYY


#1

I recently came across this little slightly annoying item, not end of world but the following might make more sense.
The CopyDateToStringMMDDYY command works great but I discovered that if you use it to add the resulting string to a file name when writing a file to say the MicroSD or elsewhere, the result is not you would be expecting. The “/” chr 47 is used to separate the days, months and years and as a file path, that doesn’t work to well…it creates folders instead.
I would suggest changing the “/” chr 47 to “-” chr 45 in the command and then it would not be necessary to add the following workaround:
Result = SetNthCharacter(45, DateString, 2);
Result = SetNthCharacter(45, DateString, 5);


#2

I ran into something similar recently, too. But no only did I want a - instead of a / but I also wanted the (not-built-in) YYYY-MM-DD format: Here’s how I did it:

DateToStringDDMMYYYY(sDateString); // Want YYYY-MM-DD vs: 
//DD/MM/YYYY 
//0123456789

// initialize the date stamp before we overwrite it
sYYYY_MM_DD = "YYYY-MM-DD";
sYYYY_MM_DD[0] = sDateString[6];
sYYYY_MM_DD[1] = sDateString[7];
sYYYY_MM_DD[2] = sDateString[8];
sYYYY_MM_DD[3] = sDateString[9];
sYYYY_MM_DD[4] = '-';
sYYYY_MM_DD[5] = sDateString[3];
sYYYY_MM_DD[6] = sDateString[4];
sYYYY_MM_DD[7] = '-';
sYYYY_MM_DD[8] = sDateString[0];
sYYYY_MM_DD[9] = sDateString[1];

In case that helps!
-Mary