how to fix 'The field must be a date' on a datetime property in mvc

前端 未结 13 1129
逝去的感伤
逝去的感伤 2020-12-29 06:59

I need to capture date and time both for my model property. In my model class I have the following

[Required]
[DataType(DataType.DateTime)]
public DateTime?          


        
13条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-29 07:30

    I have to validate dd/mm/yyyy hh:ii and with help of @lukyer answer i have added DD/MM/YYYY HH:mm and it is working fine Hope this help !

提交回复
热议问题