Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/29.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/apache-kafka/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 我想为每个月生成payperiod_C#_Asp.net - Fatal编程技术网

C# 我想为每个月生成payperiod

C# 我想为每个月生成payperiod,c#,asp.net,C#,Asp.net,我第一次创建了付款期计划,类型是Monthly,比如开始、结束、交易,付款期的功能如下: 2012年1月1日上午12:00、2008年1月30日上午11:59、2008年1月31日下午12:00 以上是第一个月的付款期。下个月,它将自动创建并插入数据库我做什么 2012年2月1日上午12:00,2012年2月28日下午11:59,2012年2月29日下午12:00 请帮帮我 for(int i=1;我阅读了更新后的问题。谢谢您的快速回复。它返回以下错误{System.ArgumentOutOfR

我第一次创建了付款期计划,类型是Monthly,比如开始、结束、交易,付款期的功能如下:

  • 2012年1月1日上午12:00、2008年1月30日上午11:59、2008年1月31日下午12:00
  • 以上是第一个月的付款期。下个月,它将自动创建并插入数据库我做什么

  • 2012年2月1日上午12:00,2012年2月28日下午11:59,2012年2月29日下午12:00

  • 请帮帮我

    for(int i=1;我阅读了更新后的问题。谢谢您的快速回复。它返回以下错误{System.ArgumentOutOfRangeException:Year、Month和Day参数描述了不可表示的日期时间。@Fernando抱歉,我编辑代码时出错。
    
    for (int i = 1; i <= 12; ++i)
    {
        DateTime firstDate = new DateTime(2012, i, 1, 0, 0, 0);
        int daysInMonth = DateTime.DaysInMonth(2012, i);
        DateTime endDate = new DateTime(2012, i, daysInMonth-1, 23, 59, 59);
        DateTime TransactionDate = new DateTime(2012, i, daysInMonth, 0, 0, 0);
        Console.WriteLine(firstDate.ToString() + 
                    "," + endDate.ToString() + 
                    "," + TransactionDate.ToString());
     }