ModelGenericExtensionsDisplayDateTime Method

Converts a DateTimeOffset to a human-readable string. If dto and user's timezone are the same timezone offset (e.g. both are Central Europe Summer Timezone) dto's offset is UTC, the time will be displayed in the user's timezone. Otherwise, the time will be displayed in the user's timezone with a note of the original timezone. The formatting is based on the language of the user.

Definition

Namespace: MobileTrack.Common.Extensions
Assembly: MobileTrack.Common (in MobileTrack.Common.dll) Version: 0.7+ce90b2cf6b782b8d7b7fd47b3c546987c652c00f
public static string DisplayDateTime(
	this DateTimeOffset dto,
	IStringLocalizer loc,
	AccountDto user
)

Parameters

dto  DateTimeOffset
Date time with offset to display
loc  IStringLocalizer
Localization tools
user  AccountDto
The user to localize it for (by using the user's timezone and language settings)

Return Value

String
Generated string to display to the user or put inside a generated document

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type DateTimeOffset. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also