Click or drag to resize

DateTimeExtensionsToSecondPrecision Method (DateTime)

Returns the specified DateTime value truncating the precision to the previous second.

Namespace:  TestHelperExtensions
Assembly:  CBI.TestHelperExtensions (in CBI.TestHelperExtensions.dll) Version: 2.1.0.1
Syntax
public static DateTime ToSecondPrecision(
	this DateTime value
)

Parameters

value
Type: SystemDateTime
The DateTime value for which precision should be adjusted.

Return Value

Type: DateTime
A DateTime value representing the target value modified to be precise only to the second.

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).
Remarks
Is often used to make DateTime comparisons work better since a difference in precision between 2 DateTime values will cause comparisons to fail that should otherwise match.
See Also