首页 > 解决方案 > 在 mvc 5 中验证日期时间

问题描述

我遇到了与日期时间验证检查有关的问题。在我使用的模型中 在此处输入图像描述

鉴于: 在此处输入图像描述

但在输入“13/03/2019 14:55”时显示错误 在此处输入图像描述 感谢您的帮助

标签: asp.net-mvc

解决方案


在我的 edm 模型中,我使用这种语法,试试看:

[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public Nullable<System.DateTime> last_update { get; set; }

希望这有帮助。

狮子座


推荐阅读