Call the Date
property on any DateTime
struct
EffectiveDate.Date;
or call
EffectiveDate.ToShortDateString();
or use the "d" format when calling ToString()
more DateTime formats here.
EffectiveDate.ToString("d");
Writing a Linq query could look like this:
someCollection.Select(i => i.EffectiveDate.ToShortDateString());
and if EffectiveDate
is nullable you can try:
someCollection
.Where(i => i.EffectiveDate.HasValue)
.Select(i => i.EffectiveDate.Value.ToShortDateString());
DateTime.Date Property
A new object with the same date as this instance, and the time value set to 12:00:00 midnight (00:00:00).
DateTime.ToShortDateString Method
A string that contains the short date string representation of the current DateTime object.