def _getScore(self): """ Returns a string representing the scoreboard """ # No score to show yet, show time when the match starts if not self._hasStarted(): return "{}:{}".format(leadingZero(str(self.start.hour)), leadingZero(str(self.start.minute))) return "{} - {}".format(self.homeScore, self.awayScore)
def getTitle(day, dayDT, week): # now = timeFormatters.dateTimeNow() # if timeFormatters.weekdayToInt(day) < now.weekday(): # week += 1 day = day[0].upper() + day[1:].lower() titleString = "{} {}/{}/{}".format( day, stringFormatters.leadingZero(dayDT.day), stringFormatters.leadingZero(dayDT.month), dayDT.year) return titleString, week
def dmToDatetime(self, day, month): """ Converts a day + month to a datetime instance. :param day: the day in the date :param month: the month in the date :return: a datetime instance representing the next time this date occurs, and a formatted string for this date """ now = timeFormatters.dateTimeNow() year = now.year # Add an extra year to the date in case it has already passed if month < now.month or (month == now.month and day < now.day): year += 1 # Create a datetime object for this birthday timeString = "{}/{}/{}".format( stringFormatters.leadingZero(str(day)), stringFormatters.leadingZero(str(month)), year) dayDatetime = datetime.datetime.strptime(timeString, "%d/%m/%Y") return dayDatetime, timeString