.NET Date without Time - is there one, or should I not need one?

No, there isn't one, and yes, there should be.

I don't believe there's a good reason other than that the date and time API in .NET isn't very good in my (very biased) view.

I'm working on a new API called Noda Time which of course does have a date-only class in (LocalDate) but it's not ready for production yet. It may already do everything you need it to, of course, and if it nearly does then you could always ask for just the features you need to be implemented sooner rather than later...


I created a simple Date struct for times when you need a simple date without worrying about time portion, timezones, local vs. utc, etc.

https://github.com/claycephas/csharp-date


In a database storage capacity is more important, so a date type that uses less space than a datetime may make sense. In an application you rarely have the need for saving those few bytes.

You could rather easily make a Date type that converts to and from DateTime, but only stores the days internally. Something like:

public struct Date {

  private int _days;

  private Date(int days) { _days = days; }

  public static implicit operator DateTime(Date date) {
    return DateTime.MinValue.AddDays(date._days);
  }

  public static implicit operator Date(DateTime dateTime) {
    return new Date((int)(dateTime - DateTime.MinValue).TotalDays);
  }

}