小编Rap*_*ael的帖子

如何从DatePicker ui jquery中删除时间

我正在使用带有asp.net mvc的jquery ui datepicker,当网页打开时,它会在datepicker的文本框中显示日期和时间(2014/10/16 00:00:00),但如果我在文本框中为datepicker选择一个日期,它只显示日期.我不想看时间,有什么不对?

谢谢!

模型中的属性设置如下

[DataType(DataType.Date)]
[Required(ErrorMessageResourceType = typeof(Ressources.Resources), ErrorMessageResourceName="ErrorStartDateRequired")]
[Display(Name = "DateStarted", ResourceType = typeof(Ressources.Resources))]
public DateTime DateStarted { get; set; }
Run Code Online (Sandbox Code Playgroud)

我的日期选择器在我的网页中设置如下:

@section scripts{
<script language="javascript" type="text/javascript">
    $(document).ready(function () {
    var anchor = document.getElementById('@Model.Anchor');
    anchor.scrollIntoView(true);

    var d = new Date(@Model.Project.DateStarted.Year, @Model.Project.DateStarted.Month, @Model.Project.DateStarted.Day);
    $("#datePickerStartDate").datepicker({
        dateFormat: "yy/mm/dd",
        showOtherMonths: true,
        selectOtherMonths: true,
        showButtonPanel: true,
        changeMonth: true,
        changeYear: true,
        gotoCurrent: true,
        defaultDate: d
    });
});
Run Code Online (Sandbox Code Playgroud)

}

这就是控件在网页中的显示方式(cshtml)

<div class="form-group">
    @Html.LabelFor(model => model.Project.DateStarted, new { @class = "control-label col-md-2" })
    <div …
Run Code Online (Sandbox Code Playgroud)

asp.net asp.net-mvc jquery jquery-ui datepicker

10
推荐指数
2
解决办法
1万
查看次数

如何知道MySQL中的CAST失败

有人可以告诉我如何使用CAST()函数检测MySQL中的转换是否失败?

这两行返回相同的值:0.

SELECT CAST('Banana' AS UNSIGNED INTEGER) AS 'CAST1';
SELECT CAST('0' AS UNSIGNED INTEGER) AS 'CAST2';
Run Code Online (Sandbox Code Playgroud)

mysql casting

5
推荐指数
1
解决办法
1140
查看次数

标签 统计

asp.net ×1

asp.net-mvc ×1

casting ×1

datepicker ×1

jquery ×1

jquery-ui ×1

mysql ×1