asp.net-mvc - 在 mvc 5 中验证日期时间
问题描述
我遇到了与日期时间验证检查有关的问题。在我使用的模型中
鉴于:
但在输入“13/03/2019 14:55”时显示错误 感谢您的帮助
解决方案
在我的 edm 模型中,我使用这种语法,试试看:
[DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:dd/MM/yyyy}")]
public Nullable<System.DateTime> last_update { get; set; }
希望这有帮助。
狮子座
推荐阅读
- python - 合并模型中的反向传播
- mysql - 使用计算列在 MySQL 中定义新列的最有效方法
- c++ - C++用户输入一个字符,变量保持为0
- c# - StreamWrite WriteLine 不能作为委托
- python - 读取和写入同一个 csv 文件 - 如果条件满足则删除行(停止 writerow 以擦除文件中的所有内容)
- android - Android Studio 没有正确显示布局
- python - 计算 TSV 文件中所有其他点之间的距离?
- javascript - 将 object.constructor 与其构造函数和 instanceof 进行比较有什么区别?
- c++11 - 在 ARM 计算库中初始化张量的正确方法?
- c# - 如何在字符串末尾包含名称的特定部分