internal static int WriteDateTimeString( char[] chars, int start, DateTime value, TimeSpan?offset, DateTimeKind kind, DateFormatHandling format) { int num1 = start; int start1; if (format == DateFormatHandling.MicrosoftDateFormat) { TimeSpan offset1 = offset ?? value.GetUtcOffset(); long javaScriptTicks = DateTimeUtils.ConvertDateTimeToJavaScriptTicks(value, offset1); "\\/Date(".CopyTo(0, chars, num1, 7); int destinationIndex = num1 + 7; string str = javaScriptTicks.ToString((IFormatProvider)CultureInfo.InvariantCulture); str.CopyTo(0, chars, destinationIndex, str.Length); int num2 = destinationIndex + str.Length; switch (kind) { case DateTimeKind.Unspecified: if (value != DateTime.MaxValue && value != DateTime.MinValue) { num2 = DateTimeUtils.WriteDateTimeOffset(chars, num2, offset1, format); break; } break; case DateTimeKind.Local: num2 = DateTimeUtils.WriteDateTimeOffset(chars, num2, offset1, format); break; } ")\\/".CopyTo(0, chars, num2, 3); start1 = num2 + 3; } else { start1 = DateTimeUtils.WriteDefaultIsoDate(chars, num1, value); switch (kind) { case DateTimeKind.Utc: chars[start1++] = 'Z'; break; case DateTimeKind.Local: start1 = DateTimeUtils.WriteDateTimeOffset(chars, start1, offset ?? value.GetUtcOffset(), format); break; } } return(start1); }
internal static long ConvertDateTimeToJavaScriptTicks(DateTime dateTime) { return(DateTimeUtils.ConvertDateTimeToJavaScriptTicks(dateTime, true)); }