且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

获取开始周和结束周之间的周数

更新时间:2023-09-19 15:33:10

public int returnTotWeeks(string s1,string s2)
{
试试
{
string [] str1 = s1.Split(''-'');
string [] str2 = s2.Split(''-'');
int d1 =(Convert.ToInt32(str2 [1])-Convert.ToInt32(str1 [1]))* 52;
返回d1 +(Convert.ToInt32(str2 [0])-Convert.ToInt32(str1 [0]))+1;
}
catch(特例除外)
{
Response.Write(错误归因于":+ ex.StackTrace);
返回0;
}
}
public int returnTotWeeks(string s1, string s2)
{
try
{
string[] str1 = s1.Split(''-'');
string[] str2 = s2.Split(''-'');
int d1 = (Convert.ToInt32(str2[1]) - Convert.ToInt32(str1[1])) * 52;
return d1 + (Convert.ToInt32(str2[0]) - Convert.ToInt32(str1[0])) + 1;
}
catch ( Exception ex)
{
Response.Write("Error due to :" + ex.StackTrace);
return 0;
}
}