Reputation: 24679
Consider this:
Dim StartDate As DateTime = #06/12/2010 6:32PM#
Dim EndDate As DateTime = #06/13/2010 10:47PM#
Dim ElapsedSpan As TimeSpan = StartDate - EndDate
Does the TimeSpan object retain the original Start and End datetimes that make up the span period? It doesn't appear to and only seems to store the amount of time elapsed not the actual end points.
If I want this too, should I create my own class, I suppose or is there a better object?
Upvotes: 5
Views: 2383
Reputation: 12401
Have a look at the DateTimeOffset
structure. This does almost what you want.
Upvotes: 1
Reputation: 8916
That is correct, timespan does not store anything dealing with the original dates as you used them above. The only reason you get a timespan with that is that the - operator is overloaded for datetime to return a timespan. I don't know of any class that would do this for you.
Upvotes: 3
Reputation: 74899
No, TimeSpan is a single measurement of an amount of time, not a specific start and end time.
Upvotes: 9