bmanmike39
asked on
How do you convert a date object to double?
How do you convert a date object to double?
DateTime com = DateTime.Now;
DateTime date1 = DateTime.MinValue;
DateTime date2 = DateTime.MinValue;
DateTime.TryParse(Label1.Text, out date1);
DateTime.TryParse(com.ToShortTimeString(), out date2);
TimeSpan ts = new TimeSpan();
ts = (date1 - date2);
double tss = Convert.ToDouble(ts);
What does the double represent? You might find the Ticks member suits your needs.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
if you use this program then this will throw exception of invalid cast....because you can not convert cast timespan to double.
what you excetly want from timespan that will get from the object of timespan ts
Regards,
nishant
what you excetly want from timespan that will get from the object of timespan ts
Regards,
nishant
ASKER
Thanks!!
LOL. Calling ToDouble on a property that returns Double?? Perhaps if someone had provided links to the documentation we would have known that TotalMilliseconds returned a Double... Oooops! Someone did : \