diff --git a/django/forms/fields.py b/django/forms/fields.py
index 4d7728f..eb6ef22 100644
--- a/django/forms/fields.py
+++ b/django/forms/fields.py
@@ -19,7 +19,7 @@ from django.core import validators
 import django.utils.copycompat as copy
 from django.utils import formats
 from django.utils.translation import ugettext_lazy as _
-from django.utils.encoding import smart_unicode, smart_str
+from django.utils.encoding import smart_unicode, smart_str, force_unicode
 from django.utils.functional import lazy
 
 # Provide this import for backwards compatibility.
@@ -336,77 +336,89 @@ class DecimalField(Field):
             raise ValidationError(self.error_messages['max_whole_digits'] % (self.max_digits - self.decimal_places))
         return value
 
-class DateField(Field):
+class BaseTemporalField(Field):
+    def __init__(self, input_formats=None, *args, **kwargs):
+        super(BaseTemporalField, self).__init__(*args, **kwargs)
+        self.input_formats = input_formats
+
+    def to_python(self, value):
+        # Try to coerce the value to unicode.
+        unicode_value = force_unicode(value, strings_only=True)
+        if isinstance(unicode_value, unicode):
+            value = unicode_value.strip()
+        # If empty, return None
+        if value in validators.EMPTY_VALUES:
+            return None
+        # If unicode, try to strptime against each import format.
+        if isinstance(value, unicode):
+            for format in self.get_input_formats():
+                try:
+                    return self.strptime(value, format)
+                except ValueError:
+                    continue
+        raise ValidationError(self.error_messages['invalid'])
+
+    def get_input_formats(self):
+        return self.input_formats or []
+
+    def strptime(self, value, format):
+        raise NotImplementedError('Subclasses must define this method.')
+
+class DateField(BaseTemporalField):
     widget = DateInput
     default_error_messages = {
         'invalid': _(u'Enter a valid date.'),
     }
 
-    def __init__(self, input_formats=None, *args, **kwargs):
-        super(DateField, self).__init__(*args, **kwargs)
-        self.input_formats = input_formats
-
     def to_python(self, value):
         """
         Validates that the input can be converted to a date. Returns a Python
         datetime.date object.
         """
-        if value in validators.EMPTY_VALUES:
-            return None
         if isinstance(value, datetime.datetime):
             return value.date()
         if isinstance(value, datetime.date):
             return value
-        for format in self.input_formats or formats.get_format('DATE_INPUT_FORMATS'):
-            try:
-                return datetime.date(*time.strptime(value, format)[:3])
-            except ValueError:
-                continue
-        raise ValidationError(self.error_messages['invalid'])
+        return super(DateField, self).to_python(value)
+
+    def get_input_formats(self):
+        return self.input_formats or formats.get_format('DATE_INPUT_FORMATS')
+
+    def strptime(self, value, format):
+        return datetime.date(*time.strptime(value, format)[:3])
 
-class TimeField(Field):
+class TimeField(BaseTemporalField):
     widget = TimeInput
     default_error_messages = {
         'invalid': _(u'Enter a valid time.')
     }
 
-    def __init__(self, input_formats=None, *args, **kwargs):
-        super(TimeField, self).__init__(*args, **kwargs)
-        self.input_formats = input_formats
-
     def to_python(self, value):
         """
         Validates that the input can be converted to a time. Returns a Python
         datetime.time object.
         """
-        if value in validators.EMPTY_VALUES:
-            return None
         if isinstance(value, datetime.time):
             return value
-        for format in self.input_formats or formats.get_format('TIME_INPUT_FORMATS'):
-            try:
-                return datetime.time(*time.strptime(value, format)[3:6])
-            except ValueError:
-                continue
-        raise ValidationError(self.error_messages['invalid'])
+        return super(TimeField, self).to_python(value)
+
+    def get_input_formats(self):
+        return self.input_formats or formats.get_format('TIME_INPUT_FORMATS')
+
+    def strptime(self, value, format):
+        return datetime.time(*time.strptime(value, format)[3:6])
 
-class DateTimeField(Field):
+class DateTimeField(BaseTemporalField):
     widget = DateTimeInput
     default_error_messages = {
         'invalid': _(u'Enter a valid date/time.'),
     }
 
-    def __init__(self, input_formats=None, *args, **kwargs):
-        super(DateTimeField, self).__init__(*args, **kwargs)
-        self.input_formats = input_formats
-
     def to_python(self, value):
         """
         Validates that the input can be converted to a datetime. Returns a
         Python datetime.datetime object.
         """
-        if value in validators.EMPTY_VALUES:
-            return None
         if isinstance(value, datetime.datetime):
             return value
         if isinstance(value, datetime.date):
@@ -419,12 +431,14 @@ class DateTimeField(Field):
             if value[0] in validators.EMPTY_VALUES and value[1] in validators.EMPTY_VALUES:
                 return None
             value = '%s %s' % tuple(value)
-        for format in self.input_formats or formats.get_format('DATETIME_INPUT_FORMATS'):
-            try:
-                return datetime.datetime(*time.strptime(value, format)[:6])
-            except ValueError:
-                continue
-        raise ValidationError(self.error_messages['invalid'])
+        return super(DateTimeField, self).to_python(value)
+
+    def get_input_formats(self):
+        return (self.input_formats or
+                formats.get_format('DATETIME_INPUT_FORMATS'))
+
+    def strptime(self, value, format):
+        return datetime.datetime(*time.strptime(value, format)[:6])
 
 class RegexField(CharField):
     def __init__(self, regex, max_length=None, min_length=None, error_message=None, *args, **kwargs):
diff --git a/tests/regressiontests/forms/tests/fields.py b/tests/regressiontests/forms/tests/fields.py
index 576a9c3..dad6003 100644
--- a/tests/regressiontests/forms/tests/fields.py
+++ b/tests/regressiontests/forms/tests/fields.py
@@ -333,6 +333,17 @@ class FieldsTests(TestCase):
         self.assertRaisesErrorWithMessage(ValidationError, "[u'Enter a valid date.']", f.clean, '10/25/2006')
         self.assertRaisesErrorWithMessage(ValidationError, "[u'Enter a valid date.']", f.clean, '10/25/06')
 
+    def test_datefield_4(self):
+        # Test whitespace stripping behavior (#5714)
+        f = DateField() 
+        self.assertEqual(datetime.date(2006, 10, 25), f.clean(' 10/25/2006 ')) 
+        self.assertEqual(datetime.date(2006, 10, 25), f.clean(' 10/25/06 ')) 
+        self.assertEqual(datetime.date(2006, 10, 25), f.clean(' Oct 25   2006 ')) 
+        self.assertEqual(datetime.date(2006, 10, 25), f.clean(' October  25 2006 ')) 
+        self.assertEqual(datetime.date(2006, 10, 25), f.clean(' October 25, 2006 ')) 
+        self.assertEqual(datetime.date(2006, 10, 25), f.clean(' 25 October 2006 ')) 
+        self.assertRaisesErrorWithMessage(ValidationError, "[u'This field is required.']", f.clean, '   ')
+
     # TimeField ###################################################################
 
     def test_timefield_1(self):
@@ -352,6 +363,13 @@ class FieldsTests(TestCase):
         self.assertEqual(datetime.time(16, 25), f.clean('4:25 PM'))
         self.assertRaisesErrorWithMessage(ValidationError, "[u'Enter a valid time.']", f.clean, '14:30:45')
 
+    def test_timefield_3(self):
+        f = TimeField()
+        # Test whitespace stripping behavior (#5714) 
+        self.assertEqual(datetime.time(14, 25), f.clean(' 14:25 ')) 
+        self.assertEqual(datetime.time(14, 25, 59), f.clean(' 14:25:59 ')) 
+        self.assertRaisesErrorWithMessage(ValidationError, "[u'This field is required.']", f.clean, '   ')
+
     # DateTimeField ###############################################################
 
     def test_datetimefield_1(self):
@@ -391,6 +409,18 @@ class FieldsTests(TestCase):
         self.assertEqual(None, f.clean(''))
         self.assertEqual('None', repr(f.clean('')))
 
+    def test_datetimefield_4(self):
+        f = DateTimeField()
+        # Test whitespace stripping behavior (#5714) 
+        self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30, 45), f.clean(' 2006-10-25   14:30:45 ')) 
+        self.assertEqual(datetime.datetime(2006, 10, 25, 0, 0), f.clean(' 2006-10-25 ')) 
+        self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30, 45), f.clean(' 10/25/2006 14:30:45 ')) 
+        self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30), f.clean(' 10/25/2006 14:30 ')) 
+        self.assertEqual(datetime.datetime(2006, 10, 25, 0, 0), f.clean(' 10/25/2006 ')) 
+        self.assertEqual(datetime.datetime(2006, 10, 25, 14, 30, 45), f.clean(' 10/25/06 14:30:45 ')) 
+        self.assertEqual(datetime.datetime(2006, 10, 25, 0, 0), f.clean(' 10/25/06 ')) 
+        self.assertRaisesErrorWithMessage(ValidationError, "[u'This field is required.']", f.clean, '   ')
+
     # RegexField ##################################################################
 
     def test_regexfield_1(self):
