This article describes the differences and the use of the d and dd Custom Format Specifiers in LightSwitch Visual Studio 2012.
Here we will see the difference and the use of the "d" and "dd" Custom Format Specifiers in LightSwitch Visual Studio 2012."d" Custom Format SpecifierThe "d" custom format specifier represents the day of the month (a number from 1 through 31). A single-digit day is represented without a leading zero.Note: If the "d" format specifier is used without other custom format specifiers, it is considered as the "d" standard date and time format specifier."dd" Custom Format SpecifierThe "dd" custom format specifier represents the day of the month (a number from 01 through 31). A leading zero is included with a single-digit day.Use the following procedure to create a sample showing how to use the "d"and "dd" Format Specifiers on a Screen.Step 1Open the LightSwitch Application in Visual Studio 2012 and go to the Solution Explorer.Right-click on "Data Sources" and choose "Add Table".The table appears in the Table Designer window. Insert the records in the following table.Step 2Now once again go to the Solution Explorer, right-click on "Screens" and choose "Add Screen".The Add New Screen dialog box appears. Select the "Editable Grid Screen" from the Screen Template, inside screen information, choose "Employee" under screen data and provide some name to the Screen and click the "OK" button.The Screen Designer appears as shown below.Press F5 to run the application. Provide the information; we will get the following output. Step 3Now stop debugging the application. From the Table Designer select the "DOB" record as shown in the figure below.Then go to the Format Pattern of Property window in the Table Designer and enter "d" in the format pattern of the properties as shown below. Here the "d" format specifier is used without other custom format specifiers, so it is considered as the "d" standard date and time format specifier.Once again press F5 to run the application. This time we will get the following output.Now if we use "d" with other custom format specifiers ("M") in the format pattern of properties.This time when we run the following application; we get the following output.Step 4Once again stop debugging the application and select the "DOB" record from the table.Now go to the Format Pattern of Property window in the Table Designer and this time enter "dd" in the format pattern as shown below.Once again press F5 to run the application. This time we will get the following output.
Printing in C# Made Easy