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
247 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

863 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

27 Experts available now in Live!

Get 1:1 Help Now