internal static int WriteDefaultIsoDate(char[] chars, int start, DateTime dt) { int num1 = 19; int year; int month; int day; DateTimeUtils.GetDateValues(dt, out year, out month, out day); DateTimeUtils.CopyIntToCharArray(chars, start, year, 4); chars[start + 4] = '-'; DateTimeUtils.CopyIntToCharArray(chars, start + 5, month, 2); chars[start + 7] = '-'; DateTimeUtils.CopyIntToCharArray(chars, start + 8, day, 2); chars[start + 10] = 'T'; DateTimeUtils.CopyIntToCharArray(chars, start + 11, dt.Hour, 2); chars[start + 13] = ':'; DateTimeUtils.CopyIntToCharArray(chars, start + 14, dt.Minute, 2); chars[start + 16] = ':'; DateTimeUtils.CopyIntToCharArray(chars, start + 17, dt.Second, 2); int num2 = (int)(dt.Ticks % 10000000L); if (num2 != 0) { int digits = 7; for (; num2 % 10 == 0; num2 /= 10) { --digits; } chars[start + 19] = '.'; DateTimeUtils.CopyIntToCharArray(chars, start + 20, num2, digits); num1 += digits + 1; } return(start + num1); }
internal static int WriteDateTimeOffset( char[] chars, int start, TimeSpan offset, DateFormatHandling format) { chars[start++] = offset.Ticks >= 0L ? '+' : '-'; int num1 = Math.Abs(offset.Hours); DateTimeUtils.CopyIntToCharArray(chars, start, num1, 2); start += 2; if (format == DateFormatHandling.IsoDateFormat) { chars[start++] = ':'; } int num2 = Math.Abs(offset.Minutes); DateTimeUtils.CopyIntToCharArray(chars, start, num2, 2); start += 2; return(start); }