Example #1
0
        static public String ToDMTFTime(DateTime wfcTime)
        {
            String dmtf = string.Empty;

            dmtf += wfcTime.Year.ToString();
            dmtf += wfcTime.Month.ToString().PadLeft(2, '0');
            dmtf += wfcTime.Day.ToString().PadLeft(2, '0');
            dmtf += wfcTime.Hour.ToString().PadLeft(2, '0');
            dmtf += wfcTime.Minute.ToString().PadLeft(2, '0');
            dmtf += wfcTime.Second.ToString().PadLeft(2, '0');
            dmtf += ".";
            dmtf += wfcTime.Millisecond.ToString().PadLeft(3, '0');

            dmtf += "000";              //this is to compensate for lack of microseconds in DateTime

            TimeZone curZone    = TimeZone.CurrentTimeZone;
            long     tickOffset = curZone.GetUTCOffset(wfcTime);


            if (tickOffset >= 0)
            {
                dmtf += "+";
                dmtf += (tickOffset / 60000).ToString();
            }
            else
            {
                dmtf += "-";
                dmtf += (tickOffset / 60000).ToString().Substring(1, 3);
            }

            return(dmtf);
        }