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 |
---|---|---|
Date |
dt |
Returns
Type | Description |
---|---|
System. |
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 |
---|---|---|
Date |
dt | The date. |
Date |
truncateTo | The level to truncate the date to. |
Returns
Type | Description |
---|---|
Date |
The truncated date. |