All pastes #205739 Raw Edit

Mine

public text v1 · immutable
#205739 ·published 2006-10-17 00:51 UTC
rendered paste body
def forceFourDigitDates(formatter):
    """ If this formatter isn't using a 4-digit year, force it to. """
    pattern = formatter.dateFormat.toPattern()
    if pattern.find('yyyy') == -1:
        formatter.dateFormat.applyPattern(pattern.replace('yy','yyyy'))
    return formatter
    
shortDateFormat = forceFourDigitDates(DatetimeFormatter(
    PyICU.DateFormat.createDateInstance(PyICU.DateFormat.kShort)))
mediumDateFormat = forceFourDigitDates(DatetimeFormatter(
    PyICU.DateFormat.createDateInstance(PyICU.DateFormat.kMedium)))