Esempio n. 1
0
        public static String ShiftingTime(bool isWinter)
        {
            Kernel32.TimeZoneInformation t  = TimeZone();
            Kernel32.SystemTime          to = isWinter ? t.standardDate : t.daylightDate;
            Kernel32.SystemTime          st;
            Kernel32.GetSystemTime(out st);
            if (st.Month > to.Month)
            {
                st.Year++;
            }

            short days = 31;

            Kernel32.SystemTime t1 = new Kernel32.SystemTime(new DateTime(st.Year, to.Month, days));
            while (t1.DayOfWeek != to.DayOfWeek)
            {
                days--;
                t1 = new Kernel32.SystemTime(new DateTime(st.Year, to.Month, days, to.Hour, to.Minute, to.Second));
            }

            return("Переход на " + (isWinter ? "зимнее" : "летнее") + " время: " + FormatDate(t1) + " в " + FormatTime(t1));
        }
Esempio n. 2
0
 public static string FormatTime(Kernel32.SystemTime st)
 {
     return(String.Format("{0,2}", st.Hour.ToString("D2")) + ":" + String.Format("{0,2}", st.Minute.ToString("D2")) + ":" + String.Format("{0,2}", st.Second.ToString("D2")));
 }
Esempio n. 3
0
 public static string FormatDate(Kernel32.SystemTime st)
 {
     return(String.Format("{0,2}", st.Day.ToString("D2")) + "." + String.Format("{0,2}", st.Month.ToString("D2")) + "." + st.Year);
 }