Back to school sale! Save up to 50%
Grab Yours

Datetime columns

Datetime columns in wpDataTables

The “Datetime” column type is used for values that contain both date and time segments. Datetime columns will render the date and time values in the format you specify on the plugin settings page.

  • Rendering rules: the value is cast as a date and time, and then formatted using the format defined in the plugin settings.
  • Sorting rules: datetime.
  • Applicable filter types: datetime range.
  • Issues to note:
    • When working with Excel files, it’s the best to set the format of Datetime columns as plain text since the PHPSpreadsheet library that parses Excel files does not parse all the Excel date format correctly. This results in a wrong rendering of the dates (they usually get reset to 01/01/1970).
    • When you’re working with MySQL, please cast timestamps columns to datetime to avoid problems.
    • Global search doesn’t support search by datetime.

Example of a table with DateTime columns

Date & Time” column in this table is of Datetime type.

Datetime Table

wdt_ID Date & time Home team Away team Stadium
1 22/10/2020 01:30 PM Bournemouth Tottenham Dean Court
2 22/10/2020 04:00 PM Arsenal Middlesbrough Emirates Stadium
3 22/10/2020 04:00 PM Burnley Everton Turf Moor
4 22/10/2020 04:00 PM Hull City Stoke City KCOM Stadium
5 22/10/2020 04:00 PM Leicester City Crystal Palace King Power Stadium
6 22/10/2020 04:00 PM Swansea City Watford Liberty Stadium
7 22/10/2020 04:00 PM West Ham United Sunderland London Stadium
8 22/10/2020 06:30 PM Liverpool West Bromwich Albion Anfield
9 22/10/2020 06:30 PM Manchester City Southampton Etihad Stadium
10 22/10/2020 07:30 PM Chelsea Manchester United Stamford Bridge
Date & time Home team Away team Stadium

Datetime column settings

Date-time column option

You may notice that in some cases when you create a table using “Create a table linked to an existing data source“, the “Datetime” column is not rendering well (Some cell values are missing). This happens when the plugin is unable to guess the format in which the Datetime is stored in the data source. In most cases it guesses correctly, but sometimes it is necessary to configure the input format manually. To do so, open the column settings for the column, go to the “Date” tab, and change the “Date input format” to match the format in the data source. This can happen for CSV, JSON, XML or Google Spreadsheet inputs, or if you are using Excel and store Datetime cells in plain text format.

Wait, Before You Download!

To get your hands on wpDataTables Lite, please enter your email address below. We’ll send you a direct download link and keep you updated on existing features along with helpful tips and tricks!

By continuing, I accept Privacy Policy and T&C
Mail Box