STR: = '2017-4-13 06:22:22 ';
Strtodatetime (STR );
Symptom: no error is reported in WINXP or win2003.
However, in Windows 7 and Windows Server 2008, the error 'xxx' is not a valid date and time is reported.
Later, we found that the default short date styles for different operating systems were different.
In WINXP and win2003, the default short date style is XXXX-XX-xx.
In Windows 7 and Windows Server 2008, the default short date style is xxxx/X/xx.
You can view the short date style through the control panel ----> region settings -------> date ----->
You can modify the registry for better program compatibility.
In HKEY_CURRENT_USER \ Control Panel \ International, the value of sdate is forcibly set '/',
This method is not very good. The best thing is that the program makes judgment and adapts to the system, instead of changing the system settings to adapt to the program.