Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 987
  • Last Modified:

How to compare date without time portion?

I am comparing a date entered in a textbox with DateTime.Now. If date by user is today, the comparison

if (txtDate.text > DateTime.Now) is true. My guess is that the time portion of txt entered is today midnight.

What's the best to do date comparison without using the time portion?
0
jentel2
Asked:
jentel2
  • 2
1 Solution
 
p_davisCommented:
DateTime.Now.Date
0
 
p_davisCommented:
if(Convert.ToDateTime(txtDate.text).Date > DateTime.Now.Date)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now