System.TimeSpan

Represents a period of time, for example 2 hours, 15 minutes
Allows you to store a measured interval of time
TimeSpan stored its time interval as the number of ticks equal to that interval
in .NET 4.0 the timespan structure supports custom formatting using the .ToString method ??


Dim objTimeSpan As System.TimeSpan 
objTimeSpan = System.TimeSpan.FromDays(2)

This is measures as a positive or negative number of days, hours, minutes and seconds (as fractions)


Dim objTimeSpan As System.TimeSpan 
objTimeSpan = New System.TimeSpan(2,12,0,0) ' 2.5 days
objTimeSpan = New System.TimeSpan(4,12) '4.5 days
objTimeSpan = New System.TimeSpan(2,14,18) '??


TimeSpan.Zero 
objTimeSpan = objDateTime1 - objDateTime2


Operators Supported

You can add or subtract time durations using the normal operators.

=assignment
=equality
+addition
-subtraction
<>inequality
>greater than
>=greater than or equal to
<less than
<=less than or equal to
-unary negation
+unary plus

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited TopPrevNext