How do I subtract two DateTime values from another DateTime value and have the result saved to a double?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In .NET, if you subtract one
DateTimeobject from another, you will get aTimeSpanobject. You can then use theTicksproperty on thatTimeSpanobject to get the number of ticks between the twoDateTimeobjects. However, the ticks will be represented by aLong, not aDouble.There are other interesting properties on the
TimeSpanobject likeTotalMillisecondsandTotalMinutesand things like that which can help you out, and may be more what you are looking for.