📄 compare.cs
字号:
using System;
/*
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
*/
namespace util.user
{
public class compare
{
public static int compareDate(int beginYear, int beginMonth, int beginDay, int endYear, int endMonth, int endDay)
{
DateTime nowTime = DateTime.Now;
DateTime beginTime = new DateTime(beginYear, beginMonth, beginDay, 0, 0, 0);
DateTime endTime = new DateTime(endYear, endMonth, endDay, 0, 0, 0);
if (beginTime <= endTime)
{
if (beginTime >= nowTime.AddMonths(-6))
{
if (beginTime <= endTime.AddMonths(-3))
{
return -3;//结束时间比开始时间超过三个月
}
else
{
return 0;
}
}
else
{
return -2; //开始时间超过半年
}
}
else
{
return -1; //结束时间小于开始时间
}
}
public static int compareTime(int beginYear, int beginMonth, int beginDay, int beginH, int beginMi, int endYear, int endMonth, int endDay, int endH, int endMi)
{
DateTime nowTime = DateTime.Now;
DateTime beginTime = new DateTime(beginYear, beginMonth, beginDay, beginH, beginMi, 0);
DateTime endTime = new DateTime(endYear, endMonth, endDay, endH, endMi, 0);
if (beginTime <= endTime)
{
if (beginTime >= nowTime.AddMonths(-6))
{
if (beginTime <= endTime.AddMonths(-1))
{
return -3;//结束时间比开始时间超过一个月
}
else
{
return 0;
}
}
else
{
return -2; //开始时间超过半年
}
}
else
{
return -1; //结束时间小于开始时间
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -