Search code examples
c#winformsdevexpressxtragrid

DevExpress XtraGrid: How to force a datetime format that does not take the system's short/long date setting


In our company, the Windows regional settings for long date and short date are customized to always show the name of the day like this: "dddd dd MMMM yyyy" for "friday, April 12, 2012".

In our CRM software, we use a lot of DevExpress Component and in one of the XtraGrid, I would like to avoid the default system behavior and show a custom formating.

I did set my column to display the format type : "DateTime" and the FormatString: "G" as specified on MSDN but when I run the software it still show the system short date (friday, April 12, 2012)

Is there a way to force a Display format that does not uses the system default ?

Thank you


Solution

  • You can specify any custom format string you want in the DisplayFormat.FormatString property. You're not limited to the standard format strings. For example, you could specify the column's format as:

    FormatString = "MM/dd/yyyy"
    

    and you would get standard US-style short date format.