我工作登记表上在Django 我正在从日期字段从前端输入"12/15/2016"
,但我想它像12 dec 2016
保存在我的Django的数据库。 我用这压延日期formator在Django
<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.4/jquery-ui.min.js"></script>
<script>
$(document).ready(function() {
$("#datepicker").datepicker();
});
</script>
我model.py
日期是
posting_date = models.DateField(blank=True)
Views.py
post_date = str(request.POST['date'])
date = post_date.split('/')
formatted_date= date[1]+"-"+date[0]+"-"+date[2]
我要救十二月,而不是12个月
可能的重复[在django中以所需格式保存日期](http://stackoverflow.com/questions/41140317/save-date-in-django-in-desired-format) –