GetDateValues() private static method

private static GetDateValues ( System.DateTime td, int &year, int &month, int &day ) : void
td System.DateTime
year int
month int
day int
return void
Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        internal static int WriteDefaultIsoDate(char[] chars, int start, DateTime dt)
        {
            int num = 19;
            int value;
            int value2;
            int value3;

            DateTimeUtils.GetDateValues(dt, out value, out value2, out value3);
            DateTimeUtils.CopyIntToCharArray(chars, start, value, 4);
            chars[start + 4] = '-';
            DateTimeUtils.CopyIntToCharArray(chars, start + 5, value2, 2);
            chars[start + 7] = '-';
            DateTimeUtils.CopyIntToCharArray(chars, start + 8, value3, 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 num3 = 7;
                while (num2 % 10 == 0)
                {
                    num3--;
                    num2 /= 10;
                }
                chars[start + 19] = '.';
                DateTimeUtils.CopyIntToCharArray(chars, start + 20, num2, num3);
                num += num3 + 1;
            }
            return(start + num);
        }
Ejemplo n.º 3
0
        internal static int WriteDefaultIsoDate(char[] chars, int start, DateTime dt)
        {
            int num;
            int num1;
            int num2;
            int num3 = 19;

            DateTimeUtils.GetDateValues(dt, out num, out num1, out num2);
            DateTimeUtils.CopyIntToCharArray(chars, start, num, 4);
            chars[start + 4] = '-';
            DateTimeUtils.CopyIntToCharArray(chars, start + 5, num1, 2);
            chars[start + 7] = '-';
            DateTimeUtils.CopyIntToCharArray(chars, start + 8, num2, 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 ticks = (int)(dt.Ticks % 10000000L);

            if (ticks != 0)
            {
                int num4 = 7;
                while (ticks % 10 == 0)
                {
                    num4--;
                    ticks /= 10;
                }
                chars[start + 19] = '.';
                DateTimeUtils.CopyIntToCharArray(chars, start + 20, ticks, num4);
                num3 = num3 + num4 + 1;
            }
            return(start + num3);
        }