LPARAMETERS tDateTime,nMilliSeconds *Routine to convert a datetime (with optional milliseconds) to the sys(2015) value LOCAL nMilliSecs,nDays,cBase36,cSys2016 * If no milliseconds are given, use the default value of 0 IF VARTYPE(nMilliSeconds)<>'N' nMilliSeconds=0 ENDIF *The total millisecs since midnight nMilliSecs=(HOUR(tDateTime)*3600+MINUTE(tDateTime)*60+SEC(tDateTime))*1000+nMilliSeconds *The total days since Jan 1st '00 (Where the total days in a (Full) year is 367) nDays=TTOD(tDateTime)-DATE(YEAR(tDateTime),1,1)+1+MOD(YEAR(tDateTime),100)*367 *The table used to 'display' the right value in the string. *The sys2015 uses a Base36, where 0=0 and Z=35 cBase36='0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' *Make the resultstring empty cSys2015='' *We are going to construct the sys2015 string from back to front. *First the total millisecs FOR nCounter=1 TO 6 *The string is the mod value +1, because 0 means char at location 1 etc. cSys2015=SUBSTR(cBase36,MOD(nMilliSecs,36)+1,1)+cSys2015 nMilliSecs=INT(nMilliSecs/36) ENDFOR *Second the days since Jan 1st '00 FOR nCounter=1 TO 3 cSys2015=SUBSTR(cBase36,MOD(nDays,36)+1,1)+cSys2015 nDays=INT(nDays/36) ENDFOR *Third, the Underscore cSys2015='_'+cSys2015 *Return the string RETURN cSys2015