Exemplo n.º 1
0
        public List <Tz> GetTimes(DateTime selectedDate, string timezoneId)
        {
            var result = new List <Tz>();

            for (int i = 0; i < 24; i++)
            {
                var date = new DateTime(selectedDate.Year, selectedDate.Month, selectedDate.Day, i, 0, 0);
                var tz   = new Tz();
                tz.BaseDateTime = date;
                tz.DateTime     = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(date, timezoneId);
                tz.TimeZoneId   = timezoneId;
                if (tz.DateTime.Day > date.Day)
                {
                    tz.IsPlusOneDay = true;
                }

                if (tz.DateTime.Day < date.Day)
                {
                    tz.IsMinusOneDay = true;
                }

                result.Add(tz);
                i++;
            }

            return(result);
        }
Exemplo n.º 2
0
        public List<Tz> GetTimes(DateTime selectedDate, string timezoneId)
        {
            var result = new List<Tz>();
            for (int i = 0; i < 24; i++)
            {
                var date = new DateTime(selectedDate.Year, selectedDate.Month, selectedDate.Day, i, 0, 0);
                var tz = new Tz();
                tz.BaseDateTime = date;
                tz.DateTime = TimeZoneInfo.ConvertTimeBySystemTimeZoneId(date, timezoneId);
                tz.TimeZoneId = timezoneId;
                if (tz.DateTime.Day > date.Day)
                {
                    tz.IsPlusOneDay = true;
                }

                if (tz.DateTime.Day < date.Day)
                {
                    tz.IsMinusOneDay = true;
                }

                result.Add(tz);
                i++;
            }

            return result;
        }