Ticket #8354: mysql-datetime.diff

File mysql-datetime.diff, 651 bytes (added by John Millikin, 16 years ago)
  • django/db/backends/mysql/base.py

    === modified file 'django/db/backends/mysql/base.py'
     
    44Requires MySQLdb: http://sourceforge.net/projects/mysql-python
    55"""
    66
     7import datetime
    78import re
    89
    910from django.db.backends import *
     
    132133        # MySQL doesn't support microseconds
    133134        if value is None:
    134135            return None
     136        if isinstance(value, datetime.datetime):
     137            return value.strftime('%Y-%m-%d %H:%M:%S')
    135138        return unicode(value.replace(microsecond=0))
    136139
    137140    def value_to_db_time(self, value):
Back to Top