Contents

C#的DateTime.Parse可以把一个字符串转换成DateTime。但是如果年份只有2位数字，它会怎么转换呢？来看看下面的代码：

A string with a date but no time component. If the time component is absent, the method assumes 12:00 midnight. If the date component has a two-digit year, it is converted to a year based on the Calendar.TwoDigitYearMax of the current culture’s current calendar or the specified culture’s current calendar (if you use an overload with a non-null provider argument).

The initial value of this property is derived from the settings in the regional and language options portion of Control Panel. However, that information can change during the life of the AppDomain. The Calendar class does not detect changes in the system settings automatically. If the calendar is not supported in the regional and language options, the initial value of this property is the default value defined by the Calendar class.

Contents