WordPress.org

Ready to get started?Download WordPress

Forums

24 hour format inside WordPress (15 posts)

  1. falke
    Member
    Posted 8 years ago #

    Is there a way to make WordPress use 24 hour format internally for example in articlelistings in the edit menu? I really dislike the am/pm-format as we dont use it in Sweden..... ;o)

    As far as I know it works alright with 24 hour format externally.

    regards/falke

  2. MichaelH
    Member
    Posted 8 years ago #

    You'll probably need to change your Theme's index.php file but take a look at Formatting_Date_and_Time for some examples.

    ********************
    Welcome to the WordPress Support Forums!

    Please help keep the Forums successful by reading:
    Using the Support Forums

    Also, remember the WordPress Codex and the FAQ pages.

    And, thank you, for letting us know if this information proves useful (or not)!
    ********************

  3. moshu
    Member
    Posted 8 years ago #

    In WP 2.0.2 see wp-admin/edit.php line 169 and modufy the date display accordin to this http://php.net/date

  4. falke
    Member
    Posted 8 years ago #

    Thanks mate! That worked in the edit view... but only there... ;o(

    I have the same problem in the pages view.... and i guess it might occur somewhere else as well.

    Is there not a way to change it globally for all of WordPress?

    regards/falke

  5. moshu
    Member
    Posted 8 years ago #

    If the parameters are hardcoded in the template tag - in this case the_time() - nothing has effect on it.

    I thought you said "externally" it works fine.

    And for your question... I hoped you would figure out by analogy that for Pages you should look somewhere in the edit-pages.php :)

  6. falke
    Member
    Posted 8 years ago #

    The best way would of course be if there were a global option for setting this.

    regards/falke

  7. falke
    Member
    Posted 8 years ago #

    Yes, moshu... I tried to change one line there without any effect.... but OK I will try another one as well.... ;o)

    Thanks mate!

  8. falke
    Member
    Posted 8 years ago #

    I changed line 53 in edit-pages.php in the same way.... no effect.

    regards/falke

  9. MichaelH
    Member
    Posted 8 years ago #

    falke's question about 'globally' changing this is a good point.

    Admin panels should honor the date and time Option->General settings.

    This issue reported to trac:
    http://trac.wordpress.org/ticket/2601

  10. falke
    Member
    Posted 8 years ago #

    Thanks for that MichaelH! I really should be easy to implement that.... just by a function call or something instead of using hard coded date format ;o)

    I have been using Xoops for a long time but I am a total newbie with WordPress, but I have already decided to move a couple of charity sites from Xoops to WordPress, because of better performance, support (all the nice people here)and speedy development. Xoops seems to have stopped developing nearly completely... ;o(

    But I cant figure out where I should make the edit to have the 24 hour date format in the edit pages view.

    regards/falke

  11. MichaelH
    Member
    Posted 8 years ago #

    Well in admin-functions.php at line 643 in WordPress 2.0.2 you can try this:

    <td><?php echo mysql2date(get_settings('date_format') .' ' . get_settings('time_format'), $post->post_modified); ?></td>

    That does make Pages adhere to the settings in Options->General.

    [EDIT]
    Looks like changing edit.php line 166 to this will work for the Posts:
    <td><?php the_time(get_settings('date_format') .' <br /> ' . get_settings('time_format')); ?></td>

  12. moshu
    Member
    Posted 8 years ago #

    Yes, you are right. It seems while in the edit.php they use a template tag (the_time), in the edit-pages.php a global variable is used (mysql2date)... which seemingly displays the time in a way that is not changeable for mortals :)
    As I stated a million times I am not a coder, so my surprise was even bigger when I realized this line (52) is referencing to the "post_modified" in the DB - and in the DB that time-cell has a nice 24 hr format. Why does it get displayed as 12 hr am/pm even after deleting all the parameters from the edit-pages.php file on line 52... that's the mystery!

    EDIT. OK, I am slow - my reply was meant to be after this.

  13. falke
    Member
    Posted 8 years ago #

    If i replaced the old dateline on line 646 with your line it worked fine..... ;o)

    The same in edit.php on line 169. How great this support forum is! Thanks mate!

    Will this be included i future versions or do I have to edit this manually when the bext version comes out?

    regards/falke

  14. MichaelH
    Member
    Posted 8 years ago #

    You can follow http://trac.wordpress.org/ticket/2601 to see if it makes it into the next release.

    If not, remember you will need to manually retrofit your changes into subsequent releases.

  15. falke
    Member
    Posted 8 years ago #

    Ok I will... thanks for the help, mate!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags