Allows to write out date values as structured iso date strings and parses iso or english dates
View code on GitHub
Inheritance Hierarchy
DeltaEngine.Extensions DateExtensions
Namespace: DeltaEngine.Extensions
Assembly: DeltaEngine (in DeltaEngine.dll) Version: 1.1.1.0 (1.1.1)
Syntax
The DateExtensions type exposes the following members.
Methods
Name | Description | |
---|---|---|
GetIsoDate | ||
GetIsoDateTime | ||
GetIsoTime | ||
IsDateNewerByOneSecond | ||
Parse |
Remarks
Examples
[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