Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/259.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
Javascript 如何在asp.net c中从所选日期获取上月日期#_Javascript_C#_Asp.net - Fatal编程技术网

Javascript 如何在asp.net c中从所选日期获取上月日期#

Javascript 如何在asp.net c中从所选日期获取上月日期#,javascript,c#,asp.net,Javascript,C#,Asp.net,所选日期为(txtfromdate):2016年12月1日 截止日期:2016年12月31日 如何用c#或javascript从2016年12月1日开始计算2016年12月31日 DateTime firstOfDecember = new DateTime(2016, 12, 1); int lastDay = DateTime.DaysInMonth(firstOfDecember.Year, firstOfDecember.Month); 如果要创建与当月最后一天等效的DateTime对

所选日期为(txtfromdate):2016年12月1日

截止日期:2016年12月31日

如何用c#或javascript从2016年12月1日开始计算2016年12月31日

DateTime firstOfDecember = new DateTime(2016, 12, 1);
int lastDay = DateTime.DaysInMonth(firstOfDecember.Year, firstOfDecember.Month);
如果要创建与当月最后一天等效的DateTime对象,请执行以下操作:

DateTime lastOfDecember = new DateTime(firstOfDecember.Year, firstOfDecember.Month, lastDay);
使用
DaysInMonth
方法
DateTime

如果要创建与当月最后一天等效的DateTime对象,请执行以下操作:

DateTime lastOfDecember = new DateTime(firstOfDecember.Year, firstOfDecember.Month, lastDay);
使用C语言中的
DaysInMonth
方法
DateTime

,您可以使用DaysInMonth

DateTime endOfMonth = new DateTime (year, month,DateTime.DaysInMonth(year, month));
在C中,可以使用DaysInMonth

DateTime endOfMonth = new DateTime (year, month,DateTime.DaysInMonth(year, month));
通过使用JQuery

var selectedData = txtfromdate;
var date = new Date(selectedData);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
所以,在lastDay变量中有一个结果

使用C#

通过使用JQuery,在endDate变量中有lastDate.

var selectedData = txtfromdate;
var date = new Date(selectedData);
var lastDay = new Date(date.getFullYear(), date.getMonth() + 1, 0);
所以,在lastDay变量中有一个结果

使用C#

In endDate变量具有lastDate