RFC 1123 "R" or "r" Format Specifier in LightSwitch 2012

This article describes how to use the RFC 1123 "R" or "r" Format Specifier in LightSwitch Visual Studio 2012.

The "R" or "r" format specifier is a format specifier for the RFC 1123 date and time format standard to represent a custom date and time format string defined by the DateTimeFormatInfo.RFC1123 pattern property. It reflects a defined standard and the property is readonly. The custom format string is "ddd, dd MMM yyyy HH':'mm':'ss 'GMT'". 

Although it expresses the time as a Universal Time Coordinate (UTC) time, the formatting operation does not modify the value of a DateTime or DateTimeOffset object, in other words being formatted. Therefore, it is necessary to convert the date and time value to UTC before it performs the formatting operation.

Use the following procedure to create a sample showing how to use the RFC 1123 "R" or "r" Format Specifier on a Screen.

Step 1

Open the LightSwitch Application in Visual Studio 2012 and go to the Solution Explorer.

Solution Explorer

Right-click on "Data Sources" and choose "Add Table".

Add Table

The table appears in the Table Designer window. Insert the records in the following table.

Employee Table

Step 2

Now once again go to the Solution Explorer, right-click on Screens and choose "Add Screen".

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.

Add New Screen

The Screen Designer appears as shown below.

Screen Designer

Step 3

Press F5 to run the application. Provide the information. 

Output of Editable grid screen

Step 4

Now stop debugging the application. From the Table Designer select the "DOJ" record as shown in the figure below.


Select DOJ from Employee

Then go to the Format Pattern of Property window in the Table Designer and enter "R" in the format pattern as shown below.

R Format Pattern Property

Or you can enter enter "r" in the format pattern as shown below.

r Format Pattern

Once again press F5 to run the application. This time we will get the following output.

Output of RFC1123 Pattern

Up Next
    Ebook Download
    View all
    Learn
    View all