~ubuntu-branches/ubuntu/quantal/python-django/quantal-security

« back to all changes in this revision

Viewing changes to django/utils/datetime_safe.py

  • Committer: Bazaar Package Importer
  • Author(s): Chris Lamb
  • Date: 2010-05-21 07:52:55 UTC
  • mfrom: (1.3.6 upstream)
  • mto: This revision was merged to the branch mainline in revision 28.
  • Revision ID: james.westby@ubuntu.com-20100521075255-ii78v1dyfmyu3uzx
Tags: upstream-1.2
ImportĀ upstreamĀ versionĀ 1.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
#
5
5
# Based on code submitted to comp.lang.python by Andrew Dalke
6
6
#
7
 
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%M/%d was a %A")
 
7
# >>> datetime_safe.date(1850, 8, 2).strftime("%Y/%m/%d was a %A")
8
8
# '1850/08/02 was a Friday'
9
9
 
10
10
from datetime import date as real_date, datetime as real_datetime
83
83
            sites.append(site)
84
84
 
85
85
    s = s1
86
 
    syear = "%4d" % (dt.year,)
 
86
    syear = "%04d" % (dt.year,)
87
87
    for site in sites:
88
88
        s = s[:site] + syear + s[site+4:]
89
89
    return s