WordPress.org

Ready to get started?Download WordPress

Forums

Codepress Admin Columns
[resolved] sorting by custom date field (3 posts)

  1. oliverspies
    Member
    Posted 1 year ago #

    hi,

    i have a custom field with a date, and when i try to sort it, it always gets sorted by the first digits

    so in my case the order looks like this:
    02.11.2012
    03.08.2012
    05.10.2012
    ...

    but it should be listed like this:
    03.08.2012
    05.10.2012
    02.11.2012

    oliver

    http://wordpress.org/extend/plugins/codepress-admin-columns/

  2. Tobias Schutter
    Member
    Plugin Author

    Posted 1 year ago #

    Hi Oliver,

    My plugin only supports the date format which is used internally by WordPress. That is 'Year-month-day hours:minutes:seconds' all in digits.

    php example:

    // displays the current time in the correct date format
    // to be saved into a custom field for example
    $current_time = date('Y-m-d H:i:s');
    echo $current_time;
    // would result in something like "2012-07-17 21:56:30"

    So in order to have the correct sorting output, you would need to save your dates as such:
    2012-11-02
    2012-08-03
    2012-10-05

    Tobias

  3. oliverspies
    Member
    Posted 1 year ago #

    ok, thank you for the reply

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic