System.DateTime theDay =
new System.DateTime(System.DateTime.Today.Year, 7, 28);
int compareValue;
try {
compareValue = theDay.CompareTo(System.DateTime.Today);
}
catch (ArgumentException) {
System.Console.WriteLine("Value is not a DateTime");
return;
} if (compareValue < 0) {
System.Console.WriteLine("{0:d} is in the past.", theDay);
}
else if (compareValue == 0) {
System.Console.WriteLine("{0:d} is today!", theDay);
}
else if (compareValue == 1) {
System.Console.WriteLine("Value is null");
}
// compareValue > 0 && compareValue != 1
else {
System.Console.WriteLine("{0:d} has not come yet.", theDay);
}
new System.DateTime(System.DateTime.Today.Year, 7, 28);
int compareValue;
try {
compareValue = theDay.CompareTo(System.DateTime.Today);
}
catch (ArgumentException) {
System.Console.WriteLine("Value is not a DateTime");
return;
} if (compareValue < 0) {
System.Console.WriteLine("{0:d} is in the past.", theDay);
}
else if (compareValue == 0) {
System.Console.WriteLine("{0:d} is today!", theDay);
}
else if (compareValue == 1) {
System.Console.WriteLine("Value is null");
}
// compareValue > 0 && compareValue != 1
else {
System.Console.WriteLine("{0:d} has not come yet.", theDay);
}
解决方案 »
- 怎么做asp.net的自定义容器控件
- fileupload上传图片事前怎么控制图片类型
- C#如何根据第几周获得那周的开始年月日和结束年月日
- 关于多个Dropdownlist和TextBox的联合查询的问题!急~~~
- 急急急啊,客户上传一个.xls,如何读出该表格的行数。
- 请问能不能做一个连接到自己新建的一个类里去
- 错误409: assignment operator 运行不能以 ntext 数据类型作为参数。为什么 我改参数为 @NewsContent ntext OUTPUT 时报错呢?
- 大侠们救救我,谁有数据库注册系统的实例给我一个
- 我在Global.asax中想添加一个可以共享的静态变量
- C#一般处理程序如何写生成excel
- Rs.Open(Sql,Conn) 和 Set Rs = Conn.Execute(Sql)到底有什么区别!
- 访问被拒?如何知道是哪个文件访问被拒?
就用<或是>来比较吧,没试...
if(str>=07:50:00&&str<=11:45:00)
{
//所要执行的程序
}
当然啦,上面的语句是错的,我就想知道,如何经过转变可以成以上形状,使 得通过时间的判断来执行相应的程序!谢谢
{
//所要执行的程序
}