Date & Number Formats
Date and number formats are configured in the application's Main class by overriding OnInitCulture. This method receives the application culture used by Lagoon.
Initialize formats
Main.cs
public class Main : LgCustomApplication
{
protected override void OnInitCulture(ApplicationCultureInfo culture)
{
base.OnInitCulture(culture);
// Sets the short format used by components and standard conversions.
culture.DateTimeFormat.ShortDatePattern = "dd/MM/yyyy";
culture.NumberFormat.NumberGroupSeparator = " ";
culture.NumberFormat.NumberDecimalSeparator = ".";
}
}
Effects of configuration
These formats are used by:
- input fields for displayed formatting;
- standard display of a date or numeric value as a string;
- calls such as
DateVariable.ToShortDateString(), which follow the current culture.
Airbus themes
For Airbus applications, the default format is already defined in Lagoon.UI.Airbus with the format dd-MMM-yy. It can still be modified in the application's Main.cs with OnInitCulture.
Client / server consistency
If a format also affects server-side processing or exports, apply consistent configuration on both the client and server sides when both layers use the application culture.