Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: Firemonkey TGrid Control Auto Formatting Dates


This question is not answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 0
James Hogle

Posts: 7
Registered: 6/15/15
Firemonkey TGrid Control Auto Formatting Dates  
Click to report abuse...   Click to reply to this thread Reply
  Posted: Jan 25, 2016 6:17 AM
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 behavior that I have missed somehow? How can I control the format of a date inside of a cell?
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02