예제 #1
0
        // ----------------------------------------------------------------------
        public void TimePeriodMapperSample()
        {
            TimeCalendar timeCalendar = new TimeCalendar();
            CultureInfo  ci           = CultureInfo.InvariantCulture;

            DateTime start = new DateTime(2011, 3, 1, 13, 0, 0);
            DateTime end   = new DateTime(2011, 3, 1, 14, 0, 0);

            Console.WriteLine("Original start: {0}", start.ToString("HH:mm:ss.fffffff", ci));
            // > Original start: 13:00:00.0000000
            Console.WriteLine("Original end: {0}", end.ToString("HH:mm:ss.fffffff", ci));
            // > Original end: 14:00:00.0000000

            Console.WriteLine("Mapping offset start: {0}", timeCalendar.StartOffset);
            // > Mapping offset start: 00:00:00
            Console.WriteLine("Mapping offset end: {0}", timeCalendar.EndOffset);
            // > Mapping offset end: -00:00:00.0000001

            Console.WriteLine("Mapped start: {0}", timeCalendar.MapStart(start).ToString("HH:mm:ss.fffffff", ci));
            // > Mapped start: 13:00:00.0000000
            Console.WriteLine("Mapped end: {0}", timeCalendar.MapEnd(end).ToString("HH:mm:ss.fffffff", ci));
            // > Mapped end: 13:59:59.9999999
        }         // TimePeriodMapperSample