Quantcast
Channel: CodeProject Latest postings for ASP.NET
Viewing all articles
Browse latest Browse all 3938

Is this data annotation correct for date and time?

$
0
0
Hi,
I'm creating models for my ASP.NET Core project. I want to use "Code First" approach to create database and tables. Please check these annotations to be correct:

[Required]
       [DataType(DataType.Date)]
       [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:MM/dd/yyyy}")]public DateTime creationDate { get; set; }
       [Required]
       [DataType(DataType.Time)]
       [DisplayFormat(ApplyFormatInEditMode = true, DataFormatString = "{0:HH:mm:ss}")]public DateTime creationTime { get; set; }


And please tell me that what 0 means inside the curly braces.

Viewing all articles
Browse latest Browse all 3938

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>