u“''值的日期格式无效。它必须为YYYY-MM-DD格式,我需要为MM-DD-YYYY

时间:2018-08-27 13:48:06

标签: javascript jquery django sqlite django-models

/ uimsapp / employee / 19543 /

中的

ValidationError

[u“''值的日期格式无效。它必须为YYYY-MM-DD格式。”]

请求方法:POST 要求网址:http://127.0.0.1:8000/uimsapp/employee/19543/ Django版本:1.8 异常类型:ValidationError 异常值:

[u“''值的日期格式无效。它必须为YYYY-MM-DD格式。”]

异常位置:/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/django/db/models/fields/init.py in to_python, 1287行 Python可执行文件:/ home / fella / djangoApps / pmo / venv / bin / python 的Python版本:2.7.15 Python路径:

['/ home / fella / djangoApps / pmo / venv / src',  '/home/fella/djangoApps/pmo/venv/lib/python2.7',  '/home/fella/djangoApps/pmo/venv/lib/python2.7/plat-x86_64-linux-gnu',  '/home/fella/djangoApps/pmo/venv/lib/python2.7/lib-tk',  '/home/fella/djangoApps/pmo/venv/lib/python2.7/lib-old',  '/home/fella/djangoApps/pmo/venv/lib/python2.7/lib-dynload',  '/usr/lib/python2.7',  '/usr/lib/python2.7/plat-x86_64-linux-gnu',  '/usr/lib/python2.7/lib-tk',  '/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages',  '/home/fella/djangoApps/pmo/venv/lib/python2.7/site-packages',  '/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/odf',  '/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/odf',  '/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/odf',  '/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/odf',  '/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/odf',  '/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/odf',  '/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/odf']

服务器时间:2018年8月27日星期一13:35:37 +0000 追溯切换到复制和粘贴视图

/home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/django/core/handlers/base.py in get_response

                                    response = wrapped_callback(request, *callback_args, **callback_kwargs)

请求信息 GET

没有GET数据 开机自检 可变值 状态

u'MALICK SALLAH'

dob

u'1990-12-15'

1 个答案:

答案 0 :(得分:0)

尝试

import datetime

old_date='1990-12-15'
new_date=datetime.datetime.strptime(old_date, '%Y-%m-%d').strftime('%m-%d-%Y')

输出: 1990年12月15日