How do I remove time portion from DateTime
within Get Set Properties
The below code is not working and I tried a few ways. I also tried dateValue.ToString("d")
private DateTime dateValue;
public DateTime DateValue
{
get
{
//First Try
return dateValue.ToShortDateString;
//Second Try
return dateValue.ToString("d")
//Third Try
DateTime dateValue = DateTime.????(not sure)
}
}
You can use the Date property.
DateTime dateValue = dateValue.Date;
So it would be
private DateTime dateValue;
public DateTime DateValue
{
get
{
return dateValue.Date;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With