Articles → LIGHT SWITCH 2011 → Change Date Format Of A Lightswitch Application

Change Date Format Of A Lightswitch Application






Software Requirement




  1. Visual studio 2010 is installed on your machine.
  2. Visual Studio 2010 service pack 1 is installed on your machine.
  3. Microsoft Visual Studio Light switch 2011 is installed on your machine.

Prerequisite Knowledge




  1. Basics about lightswitch.
  2. How to create screens in lightswitch?
  3. How to create tables in lightswitch?

Steps Of Execution




  1. Create a new project
  2. Create new tables
  3. Create new screens
  4. Add data to the screen
  5. Add code to change date format



Create A New Project




Picture showing the project structure of the lightswitch application
Click to Enlarge


Create New Tables




Picture showing the employee table in lightswitch designer
Click to Enlarge

Picture showing the training table in lightswitch designer
Click to Enlarge


Create New Screens




Picture showing the Employee and Training screen in lightswitch application
Click to Enlarge


Add Data To The Screen




Picture showing the Employee and Training screen with data in lightswitch application
Click to Enlarge


Add Code To Change Date Format




partial void Application_Initialize() {
	Dispatchers.Main.BeginInvoke(() = >{
		CultureInfo ci = (CultureInfo) Thread.CurrentThread.CurrentCulture.Clone();
		ci.DateTimeFormat.ShortDatePattern = "dd-MMM-yy";
		Thread.CurrentThread.CurrentCulture = ci;
	});
}



Output


Picture showing the Employee and Training screen with changed date format in lightswitch application
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, February 28, 2013

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250