Okay
  Public Ticket #1581432
Time (seconds)
Closed

Comments

  • tjgorman started the conversation

    I need to display some times in minutes:seconds however these are not 12/24 clock times we are displaying. We are a running club and so I need to display 5k or 10k times eg data might look like 44:30, 19:22 etc. I have read your support documents and know that you don't yet support seconds using the time format - but it seems it wouldn't suit us anyway as it is a clock format (ie 24:59 would be the maximum it would allow).

    Integers won't allow decimals and are obviously in base 10 rather than the base 60 we need.

    Is there some format you can suggest? Ideally we don't want to use a string as we need to a) calculate differences between times, b) display results over time graphically.

    Thanks in advance for any help!

  •  1,851
    Miloš replied

    HI tjgorman,
    Thank you for your purchase.

    Unfortunately we do not have seconds in our plugin built in features but I can give you some workaround.

    Only workaround with Datetime with seconds  would work is to have MySQL table with data. Times will be displayed with seconds and sorting will work but editing from WP backed is not possible. You will have to edit this time values directly in database.

    Steps you need to follow to achieve this:

    Have to go in database, find table wp_options. In this table find wdtTimeFormatin option_name column and set h:i:s as option_value for this column.

    After that you have to create new MySQL table where you will place data. This table will be called "datetime_table" in this example, and one of the column (or more then one it depends how much datetime columns do you need) will be DATETIME type:

    Then when you created a table in database, you'll have to create wpDataTable based on datetime_table from database, and you can create it if you choose Add From Data Source and select MySQL table. Your query should be:

    SELECT * FROM datetime_table

    Like that you'll show datetime with second and will be able to sort it, but only way to edit data is directly from the database. 

    Column type for this column should be Datetime in optional column setup.

    Hope this can help you out.

    Best regards.

    Kind Regards, 

    Miloš Jovanović
    [email protected]

    Rate my support

    Try our FREE mapping plugin! MapSVG - easy Google maps, interactive SVG maps and floor plans, choropleth maps and much more - https://wordpress.org/plugins/mapsvg-lite-interactive-vector-maps/

    wpDataTables: FAQ | Facebook | Twitter | InstagramFront-end and back-end demo | Docs

    Amelia: FAQ | Facebook | Twitter | InstagramAmelia demo sites | Docs | Discord Community

    You can try wpDataTables add-ons before purchasing on these sandbox sites:

    Powerful Filters | Gravity Forms Integration for wpDataTables | Formidable Forms Integration for wpDataTables | Master-Detail Tables