Your attempt to convert strcat(2020,"-11-7")
to datetime
fails because the string that is created is not a supported datetime format. Please see the list of supported formats in the doc.
However, if you try to convert strcat(2020,"-11-07")
(note the 07
instead of just 7
), then it will produce the desired result.
Converting "2020-11-7"
to datetime
does work (like you noticed) even though this is not a supported format, for backward compatibility (but it's recommended to refrain from using unsupported formats, in any case).
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…