SaaS CMS has officially launched! Learn more now.

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: 11.8.3
Syntax
public static class DateTimeExtensions

Methods

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