I wann to compare userdefine time to current time. I am define time in webconfig file and i wann compare it with current time. Plz tell me
Check time in asp.net
Hi,
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Nipun TomarRank #90 · 23K reputationPosted Dec 16, 2013, 8:09 PM EST
Try this:
DateTime t1 = DateTime.Now;
DateTime t2 = Convert.ToDateTime("5:00:00 PM");
int _NcurrentStatus = DateTime.Compare(t1, t2);
if (_NcurrentStatus==0||_NcurrentStatus>0)
{
textBox1.Text =DateTime.Now.TimeOfDay.ToString();
}
else
{
MessageBox.Show("Not delete form database", "NO deletion", MessageBoxButtons.OK, MessageBoxIcon.Stop);
}
Thanks