Topic: How To Change Format Datetime In TableGrid

How To Change Format Datetime In TableGrid ???

https://i.ibb.co/BHvGcnkF/D20250501-T131013.png

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How To Change Format Datetime In TableGrid

There may be several solutions:
1. Create a calculated field with the TEXT field type. In this field, you use the strftime() function to form the date sequence you need.
Output this calculated field to the table.
2. In the OnChange table event, write a command to change the display of the date and time. Something like this: tnxdatecolumn(Form1.TableGrid1.Columns[с]).formatmask := 'yyyy-mm-dd hh:mm:ss';

It should be noted that the second option, when large volumes of information are output to a table or Excel, MAY affect the speed
of displaying the results.

Re: How To Change Format Datetime In TableGrid

Thank You sparrow


I Try Solution 1 Create a calculated field with the TEXT field type And Use Query Converter Text To Format It OK ...
But
Solution 2 tnxdatecolumn(Form1.TableGrid1.Columns[с]).formatmask := 'yyyy-mm-dd hh:mm:ss'
Nothing has changed
It would be great if you could show me a sample project.

My Visual Database : I Love You
Easy For Beginner Student For Me

Re: How To Change Format Datetime In TableGrid

I give you a really working code.
tnxdatecolumn(Form1.TableGrid1.Columns[с]).formatmask := 'yyyy-mm-dd hh:mm:ss';
I hope you substituted your column number instead of "с" in square brackets.

5 (edited by FMR 2025-06-15 21:44:32)

Re: How To Change Format Datetime In TableGrid

prahousefamily wrote:

Thank You sparrow


I Try Solution 1 Create a calculated field with the TEXT field type And Use Query Converter Text To Format It OK ...
But
Solution 2 tnxdatecolumn(Form1.TableGrid1.Columns[с]).formatmask := 'yyyy-mm-dd hh:mm:ss'
Nothing has changed
It would be great if you could show me a sample project.

Don't forget add Script call on (OnChange) for TableGrid

Post's attachments

Attachment icon TableGrid Custom Date.zip 335.74 kb, 54 downloads since 2025-06-15 

Life is like a school;
One can learn and graduate or stay behind.