Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

Date and Time Properties in EF 6 and EF Core

The example below illustrates how to implement Date and Time Properties in an EF 6 or EF Core class.

public DateTime DateTimeProperty { get; set; }
public DateTime? DateTimeNullableProperty { get; set; }
public TimeSpan TimeSpanProperty { get; set; }