C# Class WizardWrx.Core.TimeDisplayFormatter

Use instances of this class to return dates and times, uniformly formatted by rules set by way of its properties. This class is sealed, and cannot be inherited.
Mostrar archivo Open project: txwizard/WizardWrx_NET_API

Public Methods

Method Description
FormatCurrentTime ( ) : string

Format the current time.

FormatThisTime ( DateTime pdtmThisTime ) : string

Format the specified time.

GetTimeZoneForTime ( DateTime pdtmTheTime ) : string

Return the time zone name that corresponds to a local time.

PrepareLocalAndUTCTimes ( DateTime dtmTimeLocal, DateTime dtmTimeUtc ) : string

Given a pair of DateTime structures, return them in a standardized format.

TimeDisplayFormatter ( ) : System

The default constructor initializes an instance that follows the default preferences built into the class. Hence, methods called on objects created by it are guaranteed to yield a usable string unless the DateTime value supplied to the method is, itself, invalid.

Rather than attempt to create the numerous constructors that would be required to cover every possible combination of properties, there is just one constructor. All properties are read-write. Use them to change the operating parameters. If you always use the same combination of settings, you can wrap your own class around an instance of this one.

Private Methods

Method Description
FormatAMPMToken ( DateTime pdtmTheTime, HoursFormatType penmHoursFormatType, bool pfShowAmPmAsUC ) : string
FormatCalendarDate ( DateTime pdtmTheTime, DateFieldOrder penmDateFieldOrder ) : string
FormatTheTime ( DateTime pdtmTheTime, DateFieldOrder penmDateFieldOrder, HoursFormatType penmHoursFormatType, TimePrecisionType penmTimePrecisionType, bool pfShowTimeZone, bool pfShowWeekdayName, bool pfShowAmPmAsUC ) : string
FormatTimeOfDay ( DateTime pdtmTheTime, HoursFormatType penmHoursFormatType, TimePrecisionType penmTimePrecisionType, bool pfShowAmPmAsUC ) : string
FormatTimeTokenHour ( DateTime pdtmTheTime, HoursFormatType penmHoursFormatType ) : string
FormatTimeTokenMilliseconds ( DateTime pdtmTheTime, TimePrecisionType penmTimePrecisionType ) : string
FormatTimeTokenSeconds ( DateTime pdtmTheTime, TimePrecisionType penmTimePrecisionType ) : string
FormatTimeZoneDisplay ( DateTime pdtmTheTime, bool pfShowTimeZone ) : string
FormatWeekdayNameDisplay ( DateTime pdtmTheTime, bool pfShowWeekdayName ) : string
FromatTimeTokenTicks ( DateTime pdtmTheTime, TimePrecisionType penmTimePrecisionType ) : string
InvalidEnumArgValueMessage ( string pstrName, int pintSpecifiedValue ) : string
InvalidEnumValueMessage ( string pstrName, int pintSpecifiedValue, int pintCurrentValue ) : string

Method Details

FormatCurrentTime() public method

Format the current time.
public FormatCurrentTime ( ) : string
return string

FormatThisTime() public method

Format the specified time.
public FormatThisTime ( DateTime pdtmThisTime ) : string
pdtmThisTime DateTime /// The DateTime instance to format. ///
return string

GetTimeZoneForTime() public static method

Return the time zone name that corresponds to a local time.
public static GetTimeZoneForTime ( DateTime pdtmTheTime ) : string
pdtmTheTime DateTime /// Specify the System.DateTime for which the correct time zone string /// is required. ///
return string

PrepareLocalAndUTCTimes() public static method

Given a pair of DateTime structures, return them in a standardized format.
public static PrepareLocalAndUTCTimes ( DateTime dtmTimeLocal, DateTime dtmTimeUtc ) : string
dtmTimeLocal DateTime /// Specify the local time to include in the standardized message. ///
dtmTimeUtc DateTime /// Specify the UTC time to include in the standardized message. ///
return string

TimeDisplayFormatter() public method

The default constructor initializes an instance that follows the default preferences built into the class. Hence, methods called on objects created by it are guaranteed to yield a usable string unless the DateTime value supplied to the method is, itself, invalid.
Rather than attempt to create the numerous constructors that would be required to cover every possible combination of properties, there is just one constructor. All properties are read-write. Use them to change the operating parameters. If you always use the same combination of settings, you can wrap your own class around an instance of this one.
public TimeDisplayFormatter ( ) : System
return System