Full Date Short Time ("f") and Full Date Long Time ("F") Format Specifiers in LightSwitch 2012

This article describes the differences and use of the Full Date Short Time ("f") and Full Date Long Time ("F") Format Specifiers in LightSwitch Visual Studio 2012.

Full Date Short Time ("f") Format Specifier

The Standard Full Date Short Time("f") Format Specifier represents a combination of Long Date("D") and Short Time("t") patterns separated by a space.

Note:
 The custom format string is "yyyy'-'MM'-'dd HH':'mm':'ss'Z'".

Whenever such a standard format specifier is used, the formatting operation always uses the invariant culture.

Full Date Long Time ("F") Format Specifier

The Standard Full Date Short Time("F") Format Specifier represents a custom date time format string. The Custom Format String is "dddd, dd MMMM yyyy HH:mm:ss".

Use the following procedure to create a sample showing how to use
the Full Date Short Time("f") and Full Date Long Time("F") Format Specifiers 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

Press F5 to run the application. Provide the information; we will get the following output. 

Output of Editable Grid Screen

Step 3

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

Select DOB from Employee

Then go to the Format Pattern of Property window in the Table Designer and enter "f" in the format pattern for the Full Date Short Time Format Specifier as shown below.


Full Date Short Time Format Specifier Properties

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

Short Time Output

Step 4

Once again stop debugging the application and select the "DOB" record from the table.

Select DOJ from Employee

Now go to the Format Pattern of the Property window in the Table Designer and this time enter "F" in the format pattern for Full Date Long Time Format Specifier as shown below.

Full Date Long Time Format Pattern Properties

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

Long Time Output


Similar Articles