Nucleus .Net Core CMS

FormatExtensions Class

Namespace: Nucleus.ViewFeatures
Assembly: Nucleus.ViewFeatures.dll
Extensions which format the output of various types.

Methods

FormatDate (Nullable<DateTime>,TimeZoneInfo) Method

FormatDate (Nullable<DateTime> value, TimeZoneInfo timezone)
Convert a DateTime from UTC to local time and output as a string in short date+short time format.
Parameters
Name Type
value System.Nullable<System.DateTime>
timezone TimeZoneInfo

Current user time zone. Use this.Context.Request.GetUserTimeZone() to use the auto-detected time zone.

FormatDate (DateTime,TimeZoneInfo) Method

FormatDate (DateTime value, TimeZoneInfo timezone)
Convert a DateTime from UTC to local time and output as a string in short date+short time format.
Parameters
Name Type
value DateTime
timezone TimeZoneInfo

Current user time zone. Use this.Context.Request.GetUserTimeZone() to use the auto-detected time zone.

FormatDate (DateTimeOffset,TimeZoneInfo) Method

FormatDate (DateTimeOffset value, TimeZoneInfo timezone)
Convert a DateTime from UTC to local time and output as a string in short date format.
Parameters
Name Type
value DateTimeOffset
timezone TimeZoneInfo

Current user time zone. Use this.Context.Request.GetUserTimeZone() to use the auto-detected time zone.

FormatTimeSpan (TimeSpan) Method

FormatTimeSpan (TimeSpan value)
Return a "friendly" string representation of a TimeSpan.
Parameters
Name Type
value TimeSpan

FormatTimeSpan (TimeSpan,TimespanFormats) Method

FormatTimeSpan (TimeSpan value, TimespanFormats format)
Return a "friendly" string representation of a TimeSpan.
Parameters
Name Type
value TimeSpan
format Nucleus.ViewFeatures.FormatExtensions.TimespanFormats

Specifies output format.

FormatTimeSpan (Nullable<TimeSpan>) Method

FormatTimeSpan (Nullable<TimeSpan> value)
Return a "friendly" string representation of a TimeSpan.
Parameters
Name Type
value System.Nullable<System.TimeSpan>

FormatTimeSpan (Nullable<TimeSpan>,TimespanFormats) Method

FormatTimeSpan (Nullable<TimeSpan> value, TimespanFormats format)
Return a "friendly" string representation of a TimeSpan.
Parameters
Name Type
value System.Nullable<System.TimeSpan>
format Nucleus.ViewFeatures.FormatExtensions.TimespanFormats

Specifies output format.