0

In my applications I have a grid which is bound to the object. This object has properties of DateTime type and it shows my dates in short date format specified in Control Panel. How can I force it to use long date format?

I guess new CultureInfo should be created, but I don't want to change the format, I still want to use format specified in Control Panel, but not the short one as it is done by default.

Thanks.

axe
  • 2,331
  • 4
  • 31
  • 53
  • DevExpress.XtraGrid.GridControl. I thought it's not related to the grid. – axe Oct 18 '12 at 09:48
  • A grid displaying something by default and you want change this, is grid related or not? An other way - change default regional settings on your PC – sll Oct 18 '12 at 09:50
  • No, actually it shouldn't, because I guess grid should use default ToString, which uses general format specifier, 'G'. This method uses formatting information derived from the current culture. The question is how to change general format specifier to use long date format from regional settings instead of short one. – axe Oct 18 '12 at 09:53
  • MSDN says: `The "G" standard format specifier represents a combination of the short date ("d") and long time ("T") patterns, separated by a space.` – axe Oct 18 '12 at 09:59

1 Answers1

0

OK.

I found DevExpress.Utils.FormatInfo and applied it to all date/time fields for now. I don't really like the solution, however I don't see anything better right now :(

axe
  • 2,331
  • 4
  • 31
  • 53
  • I guess there is something better. I'm looking for an attribute to set to the property and looks like I found `[Custom("DisplayFormat", "{0:G}")]` , but it doesn't seem to work (most probably I'm doing something wrong). – axe Oct 18 '12 at 10:51