Class DateTimeExtensions
Inheritance
System.Object
Namespace: Umbraco.Extensions
Assembly: Umbraco.Core.dll
Syntax
public static class DateTimeExtensions
Methods
View SourceToIsoString(DateTime)
Returns the DateTime as an ISO formatted string that is globally expectable
Declaration
public static string ToIsoString(this DateTime dt)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | dt |
Returns
| Type | Description |
|---|---|
| System.String |
TruncateTo(DateTime, DateTimeExtensions.DateTruncate)
Truncates the date to the specified level, i.e. if you pass in DateTruncate.Hour it will truncate the date to the hour.
Declaration
public static DateTime TruncateTo(this DateTime dt, DateTimeExtensions.DateTruncate truncateTo)
Parameters
| Type | Name | Description |
|---|---|---|
| DateTime | dt | The date. |
| DateTimeExtensions.DateTruncate | truncateTo | The level to truncate the date to. |
Returns
| Type | Description |
|---|---|
| DateTime | The truncated date. |