Solved

How to compare date without time portion?

Posted on 2008-09-30
2
974 Views
Last Modified: 2008-09-30
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
Comment
Question by:jentel2
  • 2
2 Comments
 
LVL 22

Expert Comment

by:p_davis
ID: 22606238
DateTime.Now.Date
0
 
LVL 22

Accepted Solution

by:
p_davis earned 500 total points
ID: 22606248
if(Convert.ToDateTime(txtDate.text).Date > DateTime.Now.Date)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now