. Net core-format conversion problem,. netcore
Recently, the project was migrated from. net to the. net core environment. After the migration is completed, the project was released on the Windows platform for testing. All functions can run normally.
To ensure that the project can run normally in the official environment, perform the Linux environment deployment (Centos7) prerelease in advance and perform the basic code test after the prerelease,
The log shows a string-to-datetime error. The same Code and test cases should not have different results !!!???~
~ I think there are still some differences between Linux and Windows. Will it be a problem with the running environment? After debugging, I found that in linux, The datetime is directly tostring or + operation with stirng,
The results are inconsistent with those in Windows. In Windows, the default format is 21:55:12, while in linux, the keyword AM/PM/AM is included,
However, if you convert the result to the date format using the DateTime. Parse () function, an error is returned !!!
This! It should be a bug in. net core sdk (linux!
Therefore, we recommend that you set the format to dt. ToString ("yyyy-MM-dd HH: mm: ss ");
This article was published on February 17,. You are welcome to join the discussion.