• Resolved jhanjon

    (@jhanjon)


    Hi Tobias,

    I’ve been using reloaded and would like to switch to Table Press. I will need to get into date formats and wonder if there’s a tutorial to guide me, or a sample table source I can glance at?

    A quick question is whether it will I be able to format via PHP date formatting? So serial date becomes Monday, July, 9, 2014?

    Speaking of which, is this a clock based serial date, or a randomly inserted date in a specific format bearing no relation to real world clock?

    This is for a non profit swim sports club.

    Joe

    https://www.ads-software.com/plugins/wp-table-reloaded/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author TobiasBg

    (@tobiasbg)

    Hi,

    thanks for your question.

    TablePress (just as WP-Table Reloaded) does not really have anything related to “date formats” built in. To TablePress, all cell content is just text, so that it does not recognize whether something is a date (in whatever format) or a number or link or just text.
    This does however become of interest when it gets to sorting such data in the generated table, that a site visitor is seeing.
    The JS library that does the sorting does recognize some common formats, for dates that will be everything that JavaScript understands by default. The most common one probably is mm/dd/yyyy.

    Now, I don’t really understand your question with “clock based serial date” and “real world clock”. Can you maybe clarify on that, maybe with an example?

    Also, what exactly are you trying to do with dates or time values? Will those be part of your tables? I can imagine the results of some swim competion, maybe?

    Regards,
    Tobias

    Thread Starter jhanjon

    (@jhanjon)

    Thanks Tobias, yes, the results and the swim meets are calendar based and need to be sorted by date. By real date I mean the date as represented by the server clock based on its time zone, whether “time” “date” “now”. In PHP this date can be formatted to display a variety of formats.

    The JS library may be sufficient since it’s the sorting I need but having access to the server date may allow a filtering of showing events from “now” meaning upcoming events.

    In any case if there’s a tutorial or some sample with code exposed which will allow me to figure it out easily would be appreciated.

    Joe

    Plugin Author TobiasBg

    (@tobiasbg)

    Hi Joe,

    I’m not sure, if I understand completely. So you would like to use some sort of dynamic date in your tables? Are the dates in your tables not simply typed in?

    TablePress does not have native functions for that, but you might then be able to achieve this by using PHP in table cells. This is not enabled by default, but there is a TablePress Extension for it at https://tablepress.org/extensions/php-in-tables/ that should be helpful here. With that, you could simply use PHP’s date() function.

    Additionally, you’ll then likely want to turn off TablePress’s internal outout caching, by extending the Shortcode with another parameter, to

    [table id=123 cache_table_output=false /]

    Depending on how the dates then look like, you’ll probably have to adjust the JavaScript library’s sorting algorithms with some custom ones. The TablePress Extension at https://tablepress.org/extensions/datatables-sorting-plugins/ should be a good starting point for that.

    Regards,
    Tobias

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘date functions tutorial’ is closed to new replies.