How can I display Date and time in TDBGrid-Columns?

Posted by: a.boenninghoff on 14 August 2019, 10:51 am EST

    • Post Options:
    • Link

    Posted 14 August 2019, 10:51 am EST

    Hello,

    I load a table over an OLE-DB-adapter into a grid. No problem. I see all colums from the loaded table. Only the columns of type “datetime” make problem.

    If I look in the datatable into one of this columns is see “14.08.2019 14:33.23”

    but in the displayed columns in the grid I see only “14.08.2019”.

    Over witch way can I show the hole information of the datetime - colums?

    I use a MS-Access database, column type defined: Date/Time

    TDBGrid-Version: 4.0.20192.375

    Regards

    Andreas

  • Posted 15 August 2019, 4:34 am EST

    dgDetail.Columns(“Fault Date”).NumberFormat = “Short Date”

  • Posted 15 August 2019, 4:42 am EST

    You can format as well with “dd-MMM-yyyy hh:mm:ss”

  • Posted 15 August 2019, 5:44 am EST

    Thanks for the hint.

    I get the formated date time information in the displayed grid now.

    Regards

    Andreas

  • Posted 16 August 2019, 1:47 am EST

    Hi Andreas,

    As rightly suggested by Neels, setting the NumberFormat property of the datetime column to “g”, is the way to meet your requirement.

    Also, for datetime type column you may want to enable/disable the DateTimeEditor while editing. For this you may use the EnableDateTimeEditor property.

    For detailed information on datetime columns in C1TrueDbGrid, you’re suggested to refer following documentation page: https://help.grapecity.com/componentone/NetHelp/c1truedbgrid/webframe.html#displayingthedateand.html

    Best wishes,

    Ruchir

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels