• Resolved steveb72

    (@steveb72)


    When importing a table from excel the date format is showing as yyyy-mm-dd 00:00:00

    I want the date format to be dd-mm-yyyy

    Is there any way of changing the default format so that it is always dd-mm-yyyy when importing an excel spreadsheet?

Viewing 14 replies - 1 through 14 (of 14 total)
  • Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for your post, and sorry for the trouble.

    Unfortunately, the direct Excel import it not working too well regarding the import of dates. Hopefully, this workaround will help: Please set the date format as desired in your Excel table. Then, save the table to a CSV file in Excel, and import that CSV file into TablePress. The CSV importer should import the date exactly as it is shown in Excel.

    Regards,
    Tobias

    Thread Starter steveb72

    (@steveb72)

    Tobias

    Yes that works superbly well now thank you very much.

    As you responded so quickly, I will make a small donation.

    Keep up the good work!

    Steve

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    no problem, you are very welcome! 🙂 Good to hear that this helped!
    And thanks for wanting to donate, I really appreciate it!

    Best wishes,
    Tobias
     
    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

    Hi Tobias,

    There are lots of questions about this so sorry if i didn’t find the answer searching around. I have a table with dates in the format mm/dd/yy. When I import in Excel, the dates show with the times as well, but the sorting works correctly. If I import in csv, the dates are in the correct format (without the times), but the sorting doesn’t work (it sorts by the first digit). Can you help me out? thanks.
    Steve

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi steve2010,

    Can you please post a link to the page with the table where this problem happens (with the correct/desired date format, but the sorting not working), so that I can take a direct look? Thanks!

    Regards,
    Tobias

    Thanks for the quick reply. Here’s the page:

    https://www.savethepostoffice.com/suspension-table/

    If I import as csv, the sorting works fine in the edit table mode, but when I insert the shortcode on this page, the sort stops working.

    Also, I have a similar table on the site, and the date format and sorting are working fine.

    https://www.savethepostoffice.com/document-table/

    Thanks again for looking into this.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    thanks for the links! It looks like the two-digit years are indeed causing problems for the sorting algorithm here. The external JavaScript library that is used for the sorting expects four-digit years, as it seems. Unfortunately, I don’t see a quick way to change this. Can you maybe change all these (in Excel, before saving to a CSV file) to four-digit years?

    Regards,
    Tobias

    Thanks for figuring that out. I will find a way to change the date format and see how it goes. That makes sense, anyway, since the table that is working uses for full year format.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    you’ll probably just have to select all cells in that column and change the date format in the cell properties.

    Regards,
    Tobias

    Now with a four-digit year, the date column sorts correctly in the default mode, but when you sort by date, it goes back to sorting by the first digit. (If I refresh the browser, it returns to the default with correct sorting.)

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    that’s strange… I can’t see why this is not working. Apparently the format auto- detection is not setting this as a “date” column. We could try to set that manually. For that, please add this to the “Custom Commands” text field on the table’s “Edit” screen:

    "columnDefs": [ { "type": "date", "targets": [ 3 ] } ]
    

    Regards,
    Tobias

    Yes, that worked! I should have looked more closely at my earlier table that was working correctly. It had that same code!!

    Thanks again.

    Plugin Author Tobias Bäthge

    (@tobiasbg)

    Hi,

    great! Good to hear that it’s working now 🙂

    Best wishes,
    Tobias
     
    P.S.: In case you haven’t, please rate TablePress here in the plugin directory. Thanks!

Viewing 14 replies - 1 through 14 (of 14 total)

The topic ‘Change the date format’ is closed to new replies.