Class DateTimeExtensions

Extension methods for System.DateTime

Inheritance
System.Object
DateTimeExtensions
Inherited Members
System.Object.ToString()
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
Namespace: EPiServer.Commerce.Extensions
Assembly: EPiServer.Business.Commerce.dll
Version: 10.8.0
Syntax
public static class DateTimeExtensions

Methods

FitToSqlDateTimeRange(DateTime)

Truncates a datetime instance so it fits inside the range representable by System.Data.SqlTypes.SqlDateTime

Declaration
[Obsolete("Use TruncateToSqlDateTimeRange in Mediachase.MetaDataPlus.Extensions namespace instead. Will remain at least until November 2016.")]
public static DateTime FitToSqlDateTimeRange(this DateTime dateTime)
Parameters
Type Name Description
System.DateTime dateTime

The date time.

Returns
Type Description
System.DateTime

The truncated date time.

FormatTimeSince(DateTime)

Displays the time since an object was sent

Declaration
public static string FormatTimeSince(this DateTime dateTime)
Parameters
Type Name Description
System.DateTime dateTime

The send time of the object

Returns
Type Description
System.String

If time is within the current day, the time will be returned as number of hours and minutes, else the time will be returned as a short date string

FormatTimeSince(DateTime, LocalizationService)

Displays the time since an object was sent

Declaration
public static string FormatTimeSince(this DateTime dateTime, LocalizationService localizationService)
Parameters
Type Name Description
System.DateTime dateTime

The send time of the object

EPiServer.Framework.Localization.LocalizationService localizationService

The localization service.

Returns
Type Description
System.String

If time is within the current day, the time will be returned as number of hours and minutes, else the time will be returned as a short date string