jQuery UI Widgets Forums Vue [jqxGrid] Export column date time to xlsx

Tagged: ,

This topic contains 1 reply, has 2 voices, and was last updated by  ivanpeevski 3 years, 4 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • [jqxGrid] Export column date time to xlsx #121099

    Vince
    Participant

    Good day,

    Is it possible to export a column with a data type of ‘date’ to excel xlsx?
    I have a date that comes from my API as a DateTimeOffset and when it is loaded into the grid and I hit export button to call this.$refs.jqxGrid.exportview, the xlsx file displays random numbers instead of the actual date.

    Shown as below
    createdDate
    44496.50347

    If I export it using this.$refs.jqxGrid.exportdata(‘xls’) then the date comes out right.

    Any help would be greatly appreciated.

    Thanks.

    [jqxGrid] Export column date time to xlsx #121104

    ivanpeevski
    Participant

    Hello Vince,

    The numbers in the xlsx file represent 2 + the number of days since 1900-01-01 , which is Excel’s default way of handling Dates.

    To customize this, you can set the cellsformat property of your date column.
    For example the following column:

    {
      text: "My date",
      datafield: 'myDate',
      cellsformat: 'dd.MM.yyyy HH:mm'
    }

    will correctly export the data to an xlsx file.

    If you have any other questions, please do not hesitate to contact us again!
    Best regards,
    Ivan Peevski
    jQWidgets Team
    https://www.jqwidgets.com

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.