web/lib/django/utils/dateformat.py
changeset 29 cc9b7e14412b
parent 0 0d40e90630ef
--- a/web/lib/django/utils/dateformat.py	Wed May 19 17:43:59 2010 +0200
+++ b/web/lib/django/utils/dateformat.py	Tue May 25 02:43:45 2010 +0200
@@ -19,7 +19,7 @@
 from django.utils.translation import ugettext as _
 from django.utils.encoding import force_unicode
 
-re_formatchars = re.compile(r'(?<!\\)([aAbBdDfFgGhHiIjlLmMnNOPrsStTUwWyYzZ])')
+re_formatchars = re.compile(r'(?<!\\)([aAbBcdDfFgGhHiIjlLmMnNOPrsStTUuwWyYzZ])')
 re_escaped = re.compile(r'\\(.)')
 
 class Formatter(object):
@@ -104,6 +104,11 @@
         "Seconds; i.e. '00' to '59'"
         return u'%02d' % self.data.second
 
+    def u(self):
+        "Microseconds"
+        return self.data.microsecond
+
+
 class DateFormat(TimeFormat):
     year_days = [None, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334]
 
@@ -118,6 +123,13 @@
         "Month, textual, 3 letters, lowercase; e.g. 'jan'"
         return MONTHS_3[self.data.month]
 
+    def c(self):
+        """
+        ISO 8601 Format
+        Example : '2008-01-02T10:30:00.000123'
+        """
+        return self.data.isoformat(' ')
+
     def d(self):
         "Day of the month, 2 digits with leading zeros; i.e. '01' to '31'"
         return u'%02d' % self.data.day