Solved

How can I compare 2 DateTimePicker control (configre to display only time) for the time and not the date?

Posted on 2006-12-01
1
249 Views
Last Modified: 2008-02-01
I'm using the following code but it's using the Date of the control and time during the comparison.  I only want to compare the time,   how can I do that?  Thanks.
 if ((toTime.Value.CompareTo(fromTime.Value)) < 0)
0
Comment
Question by:lapucca
1 Comment
 
LVL 18

Accepted Solution

by:
Ravi Singh earned 500 total points
ID: 18058587
Hi, you can use the TimeOfDay property on the DateTime object:

if (toTime.Value.TimeOfDay < fromTime.Value.TimeOfDay)
{
             
}
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

831 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