I have a class as:
public class PersianDate
{
public int Year;
public int Month;
public int Day;
public int Hour;
public int Minute;
public int Second;
public string MonthName;
}
I want that if I convert it like here:
HTools.PersianDate pDate=new HTools.PersianDate();
string date = pDate.ToString();
And I want date to be:
1396-06-14T19:17:38
How can I do that?
Override
ToString()
method fromobject
class to get the format you want.DotNetFiddle Example.