Click or drag to resize

DateTimeExtensions Class

Adds functionality that is often used for unit testing to the DateTime data type
Inheritance Hierarchy
SystemObject
  TestHelperExtensionsDateTimeExtensions

Namespace:  TestHelperExtensions
Assembly:  CBI.TestHelperExtensions (in CBI.TestHelperExtensions.dll) Version: 2.1.0.1
Syntax
public static class DateTimeExtensions

The DateTimeExtensions type exposes the following members.

Methods
  NameDescription
Public methodStatic memberEqualWithinTolerance
Determines if 2 DateTime values contain the same Date and Time to within the specified tolerance. That is, if the tolerance specified is 1 second, the DateTime values would have to be within 1 second of each other to match.
Public methodStatic memberGetRandom(DateTime)
Returns a random date/time value earlier than the value specified
Public methodStatic memberGetRandom(DateTime, DateTime)
Returns a random date/time value between the values specified
Public methodStatic memberTo100MSPrecision(DateTime)
Returns the specified DateTime value truncating the precision to the previous 100 millisecond increment.
Public methodStatic memberTo100MSPrecision(NullableDateTime)
Returns the specified DateTime value truncating the precision to the previous 100 millisecond increment. If the nullable value has no value, a null is returned.
Public methodStatic memberTo10MSPrecision(DateTime)
Returns the specified DateTime value truncating the precision to the previous 10 millisecond increment.
Public methodStatic memberTo10MSPrecision(NullableDateTime)
Returns the specified DateTime value truncating the precision to the previous 10 millisecond increment. If the nullable value has no value, a null is returned.
Public methodStatic memberToMinutePrecision(DateTime)
Returns the specified DateTime value truncating the precision to the previous minute.
Public methodStatic memberToMinutePrecision(NullableDateTime)
Returns the specified DateTime value truncating the precision to the previous minute. If the nullable value has no value, a null is returned.
Public methodStatic memberToOracleDate(DateTime)
Converts the specified DateTime value into a string that PL/SQL interprets as the DateTime value. This method is often used to create text-based sql statements for data tier tests against an Oracle database.
Public methodStatic memberToOracleDate(NullableDateTime)
Converts the specified DateTime value into a string that PL/SQL interprets as the DateTime value. If the nullable type has no value, a string containing the text "null" is returned. This method is often used to create text-based sql statements for data tier tests against an Oracle database.
Public methodStatic memberToSecondPrecision(DateTime)
Returns the specified DateTime value truncating the precision to the previous second.
Public methodStatic memberToSecondPrecision(NullableDateTime)
Returns the specified DateTime value truncating the precision to the previous second. If the nullable value has no value, a null is returned.
Top
Remarks
This library is not intended for use as production code, but instead is intended to provide functionality in the test libraries for that production code.
See Also