System.DateTimeFormat.InvalidFormatForUtc C# (CSharp) Méthode

InvalidFormatForUtc() static private méthode

static private InvalidFormatForUtc ( String format, System.DateTime dateTime ) : void
format String
dateTime System.DateTime
Résultat void
        internal static void InvalidFormatForUtc(String format, DateTime dateTime) {
        }
        

Usage Example

Exemple #1
0
 private static void FormatCustomizedTimeZone(DateTime dateTime, TimeSpan offset, string format, int tokenLen, bool timeOnly, StringBuilder result)
 {
     if (offset == DateTimeFormat.NullOffset)
     {
         if (timeOnly && dateTime.Ticks < 864000000000L)
         {
             offset = TimeZoneInfo.GetLocalUtcOffset(DateTime.Now, TimeZoneInfoOptions.NoThrowOnInvalidTime);
         }
         else if (dateTime.Kind == DateTimeKind.Utc)
         {
             DateTimeFormat.InvalidFormatForUtc(format, dateTime);
             dateTime = DateTime.SpecifyKind(dateTime, DateTimeKind.Local);
             offset   = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
         }
         else
         {
             offset = TimeZoneInfo.GetLocalUtcOffset(dateTime, TimeZoneInfoOptions.NoThrowOnInvalidTime);
         }
     }
     if (offset >= TimeSpan.Zero)
     {
         result.Append('+');
     }
     else
     {
         result.Append('-');
         offset = offset.Negate();
     }
     if (tokenLen <= 1)
     {
         result.AppendFormat((IFormatProvider)CultureInfo.InvariantCulture, "{0:0}", (object)offset.Hours);
     }
     else
     {
         result.AppendFormat((IFormatProvider)CultureInfo.InvariantCulture, "{0:00}", (object)offset.Hours);
         if (tokenLen < 3)
         {
             return;
         }
         result.AppendFormat((IFormatProvider)CultureInfo.InvariantCulture, ":{0:00}", (object)offset.Minutes);
     }
 }