Mercurial > babel > mirror
comparison babel/dates.py @ 577:e57abed6542a trunk
fix format_date() with a datetime parameter (#282)
author | fschwarz |
---|---|
date | Mon, 30 Jul 2012 21:48:55 +0000 |
parents | ca203b2af83c |
children | 5ba68e40d1d0 |
comparison
equal
deleted
inserted
replaced
576:e77dd06c40ef | 577:e57abed6542a |
---|---|
922 return ('%%0%dd' % length) % value | 922 return ('%%0%dd' % length) % value |
923 | 923 |
924 def get_day_of_year(self, date=None): | 924 def get_day_of_year(self, date=None): |
925 if date is None: | 925 if date is None: |
926 date = self.value | 926 date = self.value |
927 return (date - date_(date.year, 1, 1)).days + 1 | 927 return (date - date.replace(month=1, day=1)).days + 1 |
928 | 928 |
929 def get_week_number(self, day_of_period, day_of_week=None): | 929 def get_week_number(self, day_of_period, day_of_week=None): |
930 """Return the number of the week of a day within a period. This may be | 930 """Return the number of the week of a day within a period. This may be |
931 the week number in a year or the week number in a month. | 931 the week number in a year or the week number in a month. |
932 | 932 |