Share via


convert datetime to timespan

Question

Thursday, May 7, 2009 6:46 AM

 hi,

is it possible to convert a datetime  to timespan??

 i want to di this : 

 timespan = datetime +timespan

any ideas?

thanks

All replies (3)

Thursday, May 7, 2009 8:37 AM âś…Answered

 hi,

is it possible to convert a datetime  to timespan??

 i want to di this : 

 timespan = datetime +timespan

any ideas?

thanks

Think of a datetime as a point.

Think of a timespan as the distance between two points.

It doesn't make sense to convert between them. 

 

 


Thursday, May 7, 2009 7:03 AM

Read here

http://dotnetguts.blogspot.com/2007/06/understanding-datetime-and-timespan-in.html


Thursday, May 7, 2009 7:05 AM

DateTime has a a Ticks property; One of the TimeSpan constructors takes a ticks value.  if you combine the two you should be able to convert a datetime to a timespan.