The English date format is converted to the general date format. In the Chinese environment, if the conversion script is executed directly, an error will be reported
Message 241, level 16, status 1, line 1
Conversion failed when converting date and / or time from string.
The English date format does not count as a date format in Chinese, but only in English.
Set language us is required_ English settings
/* Author: zhang502219048 Script source: https://www.cnblogs.com/zhang502219048/p/13616995.html */ /* To convert English date format into general date format, set language US needs to be added in Chinese environment_ Set English, otherwise an error will be reported Message 241, level 16, status 1, line 1 Conversion failed when converting date and / or time from string. */ set language US_ENGLISH select cast('Jun 20 2020 4:08PM' as datetime)
Script run results:
[please indicate the source of the blog: https://www.cnblogs.com/zhang502219048/p/13616995.html ]