1

I have a firemonkey TGrid control that seems to be detecting that the text inside of a cell is a datetime, and then applying its own formatting to the cell. For example, I have three strings that are generated and put into a row on the grid.

FSch_Text  = StdDate( FOrd_Evt->SCH_DATE ) + " PM";
FGive_Text = StdDate( FOrd_Evt->GIVE_DATE)  + " PM";
FPost_Text = StdDate( FOrd_Evt->POST_DATE ) + " " + StdTime( FOrd_Evt->POST_TIME );

When these strings are placed into cells on the grid, one would expect the results would look something like this:

12/30/2015 PM | 12/30/2015 PM | 12/30/2015 1:00PM

However, the actual results I get are:

PM 12/30/2015 | PM 12/30/2015 | 1:00PM 12/30/2015

(note that in the third string, date comes first when the string is made, however the time comes first once its in the grid cell)

I deduced that the grid was detecting dates and applying its own formatting by modifying the creation of my strings like so:

FSch_Text  = "Foo " + StdDate( FOrd_Evt->SCH_DATE ) + " PM";
FGive_Text = "Bar " + StdDate( FOrd_Evt->GIVE_DATE)  + " PM";
FPost_Text = "Foobar " + StdDate( FOrd_Evt->POST_DATE ) + " " + StdTime( FOrd_Evt->POST_TIME );

After doing this, the strings show up in their cells just like how one would expect:

Foo 12/30/2015 PM | Bar 12/30/2015 PM | Foobar 12/30/2015 1:00PM

Therefore, it looks like the TGrid control is automatically applying a date format where time comes first, followed by the date.

I looked through the list of properties / options for the TGrid control, and could find nothing about setting the format of dates.

Is what I am seeing documented behaviour that I have missed somehow? How can I control the format of a date inside of a cell?

James Hogle
  • 3,010
  • 3
  • 22
  • 46

0 Answers0