This article explains the differences and the use of the Universal Sortable (u) and Universal Full (U) Format Specifiers in LightSwitch Visual Studio 2012.
This article explains the differences and the use of the Universal Sortable ("u") and Universal Full ("U") Format Specifiers in LightSwitch Visual Studio 2012.Universal Sortable ("u") Format SpecifierThe "u" Standard Format Specifier is used to represent a custom date and time format string specified by "DateTimeFormatInfo.UniversalSortableDateTimePattern". The property is readonly. It is always the same regardless of the type of culture used or the format specifier provided. Note: The custom format string is "yyyy'-'MM'-'dd HH':'mm':'ss'Z'".Whenever such standard format specifier is used, the formatting operation always uses the invariant culture.Universal Full("U") Format SpecifierThe "U" Standard Format Specifier represents a custom date and time format string that is specified by "DateTimeFormatInfo.UniversalSortableDateTimePattern". The pattern is the same as the "F" pattern (Full Date Time Pattern). Here the DateTime value is automatically converted to UTC before it is formatted.Use the following procedure to create a sample showing how to use the Universal Sortable ("u") and Universal Full ("U") 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 "Editable Grid Screen" from the Screen Template. Inside the 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 "DOJ" record as shown in the figure below.Then go to the Format Pattern of the Property window in the Table Designer and enter "u" in the format pattern for the Universal Sortable Date/Time Format Specifier as shown below.Once again press F5 to run the application. This time we will get the following output.Step 4Once again stop debugging the application and select the "Salary" record from the table.Now go to the Format Pattern of the Property window in the Table Designer and this time enter "U" in the format pattern for the Universal Full Date/Time Format Specifier as shown below.Once again press F5 to run the application. This time we will get the following output.
Printing in C# Made Easy