User281315223 posted
You can use the String.Format() method to format the text of any type of object (assuming that it can be accessed as a string) that you pass into it as seen
below :
//Example object (This is your object)
YourObject yourObject = new YourObject();
//Format your object as a String
string formattedString = String.Format("{0:D}",yourObject)
If you are using a Date object
If you want to use that particular formatting string to format a Date in the code behind, you could use the DateTime.ToString() method :
//Example Date
DateTime orderDate = DateTime.Now;
//Formatting
string formattedDate = orderDate.ToString("D");