GenericExtensionsTruncate Method |
Truncates a DateTime to a specified resolution.
A convenient source for resolution is TimeSpan.TicksPerXXXX constants.
Namespace: Lithnet.MetadirectoryServicesAssembly: Lithnet.MetadirectoryServices (in Lithnet.MetadirectoryServices.dll) Version: 1.0.6017.24765
Syntax public static DateTime Truncate(
this DateTime date,
long resolution
)
<ExtensionAttribute>
Public Shared Function Truncate (
date As DateTime,
resolution As Long
) As DateTime
public:
[ExtensionAttribute]
static DateTime Truncate(
DateTime date,
long long resolution
)
Parameters
- date
- Type: SystemDateTime
The DateTime object to truncate - resolution
- Type: SystemInt64
e.g. to round to nearest second, TimeSpan.TicksPerSecond
Return Value
Type:
DateTimeTruncated DateTime
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
DateTime. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
See Also