Articles → LIGHT SWITCH 2011 → Change date format of a lightswitch application

Change date format of a lightswitch application





  1. Software requirement
  2. Prerequisite knowledge
  3. Steps of execution
  4. Create a new project
  5. Create new tables
  6. Create new screens
  7. Add data to the screen
  8. Add code to change date format
  9. Output.

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