MVC datetime? & datetime 设置格式

时间:2021-01-17 20:09:43

设置datetime的格式,直接有方法重载进行,即使数据为datetime?格式

MVC datetime? & datetime 设置格式

设置起始时间在配置的时候添加设置

$('#closeTime').datetimepicker({ language: 'zh-CN', startDate: "2016-01-01 00:00" });

使用的是bootstrap的datetimepicker插件

<link href="@Url.StaticFile("/assets/global/plugins/bootstrap-datetimepicker/css/bootstrap-datetimepicker.min.css")" rel="stylesheet" type="text/css"/>

<script type="text/javascript" src="@Url.StaticFile("/assets/global/plugins/bootstrap-datetimepicker/js/bootstrap-datetimepicker.min.js")"></script>
<script type="text/javascript" src="@Url.StaticFile("/assets/global/plugins/bootstrap-datetimepicker/js/locales/bootstrap-datetimepicker.zh-CN.js")"></script>

$(function () {
$('#closeTime').datetimepicker({ language: 'zh-CN', startDate: "2016-01-01 00:00" });
})

http://www.bootcss.com/p/bootstrap-datetimepicker/demo.htm