def _format_dst_change(self, dst_change): if dst_change['day'].startswith('D'): return u'%02d/%02d/%02d' % (dst_change['month'], int(dst_change['day'][1:]), dst_change['time'].as_hours) else: week, weekday = map(int, dst_change['day'][1:].split('.')) weekday = tzinform.week_start_on_monday(weekday) return u'%d/%d/%d/%d' % (dst_change['month'], week, weekday, dst_change['time'].as_hours)
def _format_dst_change(self, dst_change): fmted_time = u'%02d:%02d:%02d' % tuple(dst_change['time'].as_hms) day = dst_change['day'] if day.startswith('D'): return u'%02d.%02d %s' % (int(day[1:]), dst_change['month'], fmted_time) else: week, weekday = map(int, day[1:].split('.')) weekday = tzinform.week_start_on_monday(weekday) return u'%02d.%02d.%02d %s' % (dst_change['month'], week, weekday, fmted_time)
def _format_dst_change(self, dst_change): fmted_time = u"%02d:%02d:%02d" % tuple(dst_change["time"].as_hms) day = dst_change["day"] if day.startswith("D"): return u"%02d.%02d %s" % (int(day[1:]), dst_change["month"], fmted_time) else: week, weekday = map(int, day[1:].split(".")) weekday = tzinform.week_start_on_monday(weekday) return u"%02d.%02d.%02d %s" % (dst_change["month"], week, weekday, fmted_time)
def _format_dst_change(self, dst): if dst['day'].startswith('D'): day = int(dst['day'][1:]) else: # compute the day of the month for the current year raw_week, raw_weekday = dst['day'][1:].split('.') week = int(raw_week) - 1 weekday = tzinform.week_start_on_monday(int(raw_weekday)) - 1 current_year = datetime.datetime.utcnow().year month_calendar = calendar.monthcalendar(current_year, dst['month']) day = month_calendar[week][weekday] return '%02d%02d%02d' % (dst['month'], day, dst['time'].as_hours)
def _format_dst_change(self, dst_change): _day = dst_change['day'] if _day.startswith('D'): day = _day[1:] weekday = '0' else: week, weekday = _day[1:].split('.') weekday = tzinform.week_start_on_monday(int(weekday)) if week == '5': day = '-1' else: day = (int(week) - 1) * 7 + 1 h, m, s = dst_change['time'].as_hms return u'%s/%s/%s/%s:%s:%s' % (dst_change['month'], day, weekday, h, m, s)
def _convert_day_of_week(self, day_of_week): return self._DAYS_OF_WEEK[tzinform.week_start_on_monday(day_of_week) - 1]