DateExtensions ClassDelta Engine Documentation
Allows to write out date values as structured iso date strings and parses iso or english dates View code on GitHub
Inheritance Hierarchy

System Object
  DeltaEngine.Extensions DateExtensions

Namespace: DeltaEngine.Extensions
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax

public static class DateExtensions

The DateExtensions type exposes the following members.

Methods

  NameDescription
Public methodStatic memberGetIsoDate
Public methodStatic memberGetIsoDateTime
Public methodStatic memberGetIsoTime
Public methodStatic memberIsDateNewerByOneSecond
Public methodStatic memberParse
Top
Remarks

Tests: DeltaEngine.Tests.Extensions.DateExtensionsTests
Examples

6 unit tests call DeltaEngine.Extensions.DateExtensions
[Test]
public void GetIsoDateTime()
{
    var testTime = new DateTime(2013, 11, 17, 13, 6, 1);
    Assert.AreEqual("2013-11-17 13:06:01", testTime.GetIsoDateTime());
    AssertDateTime(testTime, DateTime.Parse(testTime.GetIsoDateTime()));
}
[Test]
public void EmptyStringJustReturnsTheSmallestDate()
{
    Assert.AreEqual(DateTime.MinValue, DateExtensions.Parse(""));
}
[Test]
public void IncorrectDateStringWillReturnCurrentDateTime()
{
    AssertDateTime(DateTime.Now, DateExtensions.Parse("2013[08]17"));
    AssertDateTime(DateTime.Now, DateExtensions.Parse("2013[08]17 00"));
}
See Also