} // FormatAMPMToken private static string FormatTimeOfDay ( DateTime pdtmTheTime , HoursFormatType penmHoursFormatType , TimePrecisionType penmTimePrecisionType , bool pfShowAmPmAsUC ) { if ( penmHoursFormatType == HoursFormatType.CultureInfoShortTime ) return pdtmTheTime.ToShortTimeString ( ); else return string.Format ( _astrTimeOfDayFormat [ ( int ) penmHoursFormatType ] , // Message Template new string [ ] { FormatTimeTokenHour( pdtmTheTime , penmHoursFormatType ) , // Token 0 pdtmTheTime.Minute.ToString ( TOSTRING_MDHMS ) , // Token 1 FormatTimeTokenSeconds ( pdtmTheTime , penmTimePrecisionType ) , // Token 2 FormatTimeTokenMilliseconds ( pdtmTheTime , penmTimePrecisionType ) , // Token 3 FromatTimeTokenTicks ( pdtmTheTime , penmTimePrecisionType ) , // Token 4 FormatAMPMToken ( pdtmTheTime , penmHoursFormatType, pfShowAmPmAsUC)} ); // Token 5 } // FormatTimeOfDay
} // PrepareLocalAndUTCTimes #endregion // Public Methods #region Private Static Methods private static string FormatTheTime ( DateTime pdtmTheTime , DateFieldOrder penmDateFieldOrder , HoursFormatType penmHoursFormatType , TimePrecisionType penmTimePrecisionType , bool pfShowTimeZone , bool pfShowWeekdayName , bool pfShowAmPmAsUC ) { string strFormattedCalendarDate = FormatCalendarDate ( pdtmTheTime , penmDateFieldOrder ); string strFormattedTimeOfDay = FormatTimeOfDay ( pdtmTheTime , penmHoursFormatType , penmTimePrecisionType , pfShowAmPmAsUC ); return string.Format ( FMT_DATE_AND_TIME , // Message Template new string [ ]{ FormatWeekdayNameDisplay( pdtmTheTime , pfShowWeekdayName ) , // Token 0 strFormattedCalendarDate , // Token 1 strFormattedTimeOfDay, // Token 2 FormatTimeZoneDisplay( pdtmTheTime , pfShowTimeZone)} ); // Token 3 } // EFormatTheTime
} // FormatTimeTokenSeconds private static string FromatTimeTokenTicks ( DateTime pdtmTheTime , TimePrecisionType penmTimePrecisionType ) { if ( _astrTicksFormat [ ( int ) penmTimePrecisionType ].Length > MagicNumbers.EMPTY_STRING_LENGTH ) return string.Format ( _astrTicksFormat [ ( int ) penmTimePrecisionType ] , pdtmTheTime.Ticks.ToString ( TOSTRING_TICKS ) ); else return SpecialStrings.EMPTY_STRING; } // FromatTimeTokenTicks
} // FormatTimeTokenMilliseconds private static string FormatTimeTokenSeconds ( DateTime pdtmTheTime , TimePrecisionType penmTimePrecisionType ) { if ( _astrSecondsFormat [ ( int ) penmTimePrecisionType ].Length > MagicNumbers.EMPTY_STRING_LENGTH ) return string.Format ( _astrSecondsFormat [ ( int ) penmTimePrecisionType ] , pdtmTheTime.Second.ToString ( TOSTRING_MDHMS ) ); else return SpecialStrings.EMPTY_STRING; } // FormatTimeTokenSeconds