예제 #1
0
        /// <summary>
        /// Gets the time zone data.
        /// </summary>
        /// <param name="timeSpan">The time span.</param>
        /// <param name="useZuluModifier">if set to <c>true</c> [use zulu modifier].</param>
        /// <returns></returns>
        public static string GetTimeZoneData(TimeSpan timeSpan, bool useZuluModifier)
        {
            string result;

            if (useZuluModifier && timeSpan.Hours == 0 && timeSpan.Minutes == 0 && timeSpan.Seconds == 0 && timeSpan.Milliseconds == 0)
            {
                result = UtcZuluIdentifier.ToString();
            }
            else
            {
                result = (DateTimeUtlities.IsTimeSpanNegative(timeSpan) ? "-" : "+") + string.Format("{0:##}:{1:##}", timeSpan.Hours, timeSpan.Minutes);
            }
            return(result);
        }
예제 #2
0
        /// <summary>
        /// Determines whether [is string A time span] [the specified STR].
        /// </summary>
        /// <param name="str">The STR.</param>
        /// <returns>
        ///     <c>true</c> if [is string A time span] [the specified STR]; otherwise, <c>false</c>.
        /// </returns>
        public static bool IsStringATimeSpan(string str)
        {
            TimeSpan trash;

            return(DateTimeUtlities.TryParseTimeSpan(str, out trash));
        }
 /// <summary>
 /// Converts the time span to double.
 /// </summary>
 /// <param name="timeSpan">The time span.</param>
 /// <returns></returns>
 public static double ConvertTimeSpanToDouble(string timeSpan)
 {
     return(ConvertTimeSpanToDouble(DateTimeUtlities.ParseTimeSpan(timeSpan)));
 }