"s" and "ss" Custom Format Specifier in LightSwitch 2012

This article describes the use of "s" and "ss" Custom Format Specifiers in LightSwitch Visual Studio 2012.

"s" Custom Format Specifier

The "s" custom format specifier is used to represent the seconds from 0 to 59. It represents whole seconds that have ed since the last minute. A single-digit second is formatted without a leading zero.

Note: Suppose the "s" format specifier is used without any other custom format specifier, it will result in the "s" standard date and time format specifier as shown below in the example.

"ss" Custom Format Specifier

The "ss" custom format specifier is used to represent the seconds from 00 to 59.  It represents whole seconds that have ed since the last minute. A single-digit second is formatted with a leading zero.

Use the following procedure to create a sample showing how to use the "s" and "ss" Custom 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

Add New Screen

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

"s" Custom Format Specifier 

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 the Property window in the Table Designer and enter "s" in the Format Pattern Specifier as shown below.


s Format Pattern Property

Once again press F5 to run the application. This time we will get the following output. This will result as the "s" standard date and time format specifier.

s Format Specifier Output

 Now the "s" format specifier is used with another custom format specifier, in other words "s" is used with "t" ("s t").

s and t Format Pattern property

This time we will get the following output:

Output using s and t custom format specifier

Step 4

"ss" Custom Format Specifier

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

Now go to the Format Pattern of Property window in the Table Designer and this time enter "ss" in the format pattern  The specifier is as shown below.

ss Format Specifier Property

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

ss Custom Format Specifier

Up Next
    Ebook Download
    View all
    Learn
    View all