【发布时间】:2021-07-21 17:23:42
【问题描述】:
我想使用波斯日历类将 波斯日期 更改为 C# 中的标准 DateTime 格式。
但由于将年份更改为 1400,它抛出异常,如下所示:
ArgumentOutOfRangeException: Specified time is not supported in this calendar. It should be between 22/03/22 12:00:00 AM (Gregorian date) and 99/12/31 11:59:59 PM (Gregorian date), inclusive. (Parameter 'time')
Actual value was 0.
我检查了波斯历类,我发现了这个:
if (year < 1 || year > MaxCalendarYear || month < 1 || month > 12)
{
throw new ArgumentOutOfRangeException(null, SR.ArgumentOutOfRange_BadYearMonthDay);
}
抛出异常。 现在我应该怎么做才能解决这个问题?
【问题讨论】:
标签: c# asp.net datetime asp.net-core persian-calendar