Click or drag to resize
GenericExtensionsTruncate Method

Truncates a DateTime to a specified resolution.

A convenient source for resolution is TimeSpan.TicksPerXXXX constants.

Namespace: Lithnet.MetadirectoryServices
Assembly: Lithnet.MetadirectoryServices (in Lithnet.MetadirectoryServices.dll) Version: 1.0.6017.24765
Syntax
public static DateTime Truncate(
	this DateTime date,
	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: DateTime
Truncated 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