Ticket #10866: datetime_safe_zero_padding.2.diff

File datetime_safe_zero_padding.2.diff, 791 bytes (added by Eric Floehr <eric@…>, 16 years ago)

[corrected -- ran diff twice in first one] svn diff to add zero-padding to %Y in datetime_safe, along with doctest addition

  • django/utils/datetime_safe.py

     
    8383            sites.append(site)
    8484
    8585    s = s1
    86     syear = "%4d" % (dt.year,)
     86    syear = "%04d" % (dt.year,)
    8787    for site in sites:
    8888        s = s[:site] + syear + s[site+4:]
    8989    return s
  • tests/regressiontests/datetime_safe/tests.py

     
    3434'00'
    3535>>> datetime(*just_safe).strftime('%y')
    3636'00'
     37>>> datetime(*really_old).strftime('%Y')
     38'0020'
    3739"""
Back to Top