How to compare time
Hello Experts.....How can I compare if the entered time is LESS than the current time?...Thanks in advance
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.
VulpesPosted Jul 28, 2011, 9:30 AM
Jiteendra SampathiraoPosted Jul 28, 2011, 8:35 AM
String.Format("{0:t}", dt); // "4:05 PM' //ShortTime
Refer:Linkthen Validate it with Your text box time value...
Link2
hope it help you......
Mahesh ChandPosted Jul 28, 2011, 8:09 AM
Shivaraj PoojaryPosted Jul 28, 2011, 7:58 AM
Benjamin KemnerPosted Jul 28, 2011, 7:48 AM
if(DateTime.Parse(textBox1.Text) < DateTime.Now)
MessageBox.Show("It is before now!");
Shivaraj PoojaryPosted Jul 28, 2011, 7:42 AM
Benjamin KemnerPosted Jul 28, 2011, 7:39 AM
if (dateTimePicker1.Value < DateTime.Now)
MessageBox.Show("It is before now!");