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,
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Nipun TomarPosted Dec 17, 2013, 1:09 AM
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