简体   繁体   中英

u"'' value has an invalid date format. It must be in YYYY-MM-DD format i need it to be MM-DD-YYYY

ValidationError at /uimsapp/employee/19543/

[u"'' value has an invalid date format. It must be in YYYY-MM-DD format."]

Request Method: POST Request URL: http://127.0.0.1:8000/uimsapp/employee/19543/ Django Version: 1.8 Exception Type: ValidationError Exception Value:

[u"'' value has an invalid date format. It must be in YYYY-MM-DD format."]

Exception Location: /home/fella/djangoApps/pmo/venv/local/lib/python2.7/site-packages/django/db/models/fields/ init .py in to_python, line 1287 Python Executable: /home/fella/djangoApps/pmo/venv/bin/python Python Version: 2.7.15 Python Path:

['/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']

Server time: Mon, 27 Aug 2018 13:35:37 +0000 Traceback Switch to copy-and-paste view

/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)

Request information GET

No GET data POST Variable Value status

u'MALICK SALLAH '

dob

u'1990-12-15'

try this

import datetime

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

Output: 12-15-1990

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM