Type: System..::.Int32
Signed number indicating the relative value of t1 and t2.
value type | condition |
---|---|
less than zero | t1 is less than t2. |
zero | t1 is equal to t2. |
Greater than zero | t1 is greater than t2. |
Example:
DateTime Time1 = Convert.ToDateTime(sArray[0].Trim().ToString());
DateTime Time2 = Convert.ToDateTime(sArray[1].Trim().ToString());
if (DateTime.Compare(Convert.ToDateTime(DateTime.Now), Time1) < 0 || DateTime.Compare(Convert.ToDateTime(DateTime.Now), Time2) > 0)
{
Button B1 = (Button)e.Item.FindControl("Button1");
B1.Visible = false;
}
解释:DateTime.Compare(datetime1, datetime2)
The parameter is in time format, compare the second parameter for the first parameter, and return a value less than 0 or a value greater than 0