If you want some object, witch always return date in 2012-10-10
format from .ToString()
, you can use this struct
struct Date
{
private DateTime dateTime;
public Date(DateTime dateTime)
{
this.dateTime = dateTime.Date;
}
public override string ToString()
{
return dateTime.ToString("yyyy-MM-dd");
}
}
solved Get Date from DateTime without ToShortDateString