This article describes how to use the Date Time Datatype in LightSwitch Visual Studio 2012.The following is the procedure to create a sample of using the Date Time datatype on a Screen.Step 1Open the LightSwitch Application in Visual Studio 2012 and go to the Solution Explorer.Right-click on "Data Source" and choose "Add Table".The table appears in the table designer window. Insert the records in the following table.Here in the table I have added a record named "DOB" and I have taken its datatype as "Date Time" as shown below.Step 2From the table select the "DOB" record and go to the property window of the DOB record.Go to the Format Pattern property under the formatting section in the property window and enter "M" in Format Pattern TextBox as shown below.Step 3Now 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 "Student" under screen data and provide a name to the Screen and click the "OK" button.The Screen Designer appears as shown below.Step 3Press F5 to run the application. Provide the information and we will see the date in the following format pattern as shown below.Step 4Stop debugging the application.Once again go to the Property window of "DOB" in the Table Designer and this time enter "G" in the Format Pattern of the property window. Step 5Once again press F5 to run the application. This time we will see the date in the following pattern as shown below.Note that the Date Time Picker and the Date Time Viewer control will ignore the Format Pattern property. Only the TextBox and the Label control will follow this property.To learn more Format Pattern, see Date and Time Format Pattern.
You need to be a premium member to use this feature. To access it, you'll have to upgrade your membership.
Become a sharper developer and jumpstart your career.
$0
$
. 00
monthly
For Basic members:
$20
For Premium members:
$45
For Elite members: