相关疑难解决方法(0)

年,月和日参数描述波斯日历中无法表示的DateTime

我使用以下代码来呈现今天的波斯日期......我工作的网站自两个月前开始上网并且工作正常但今天我收到了以下错误:

年,月和日参数描述不可表示的DateTime.

我不知道为什么会这样......有什么方法可以解决这个问题吗?

protected void lbnChangeDate_Click(object sender, EventArgs e)
{

    PersianCalendar p = new PersianCalendar();
    DateTime date = DateTime.Now;
    int year = p.GetYear(date);
    int month = p.GetMonth(date);
    int day = p.GetDayOfMonth(date);
    DateTime d1 = new DateTime(year, month, day);
    MultiView6.SetActiveView(View12);
    txtDate.Text = DateTime.Parse(d1.ToString()).ToString("yyyy/MM/dd");

}
Run Code Online (Sandbox Code Playgroud)

c# asp.net datetime

3
推荐指数
1
解决办法
2万
查看次数

标签 统计

asp.net ×1

c# ×1

datetime ×1