Support » Fixing WordPress » 24 hour format inside WordPress

  • 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.


Viewing 14 replies - 1 through 14 (of 14 total)
  • 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)!

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

    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?


    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 🙂

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


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

    Thanks mate!

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


    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:

    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.


    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.

    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>

    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.

    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?


    You can follow to see if it makes it into the next release.

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

    Ok I will… thanks for the help, mate!

Viewing 14 replies - 1 through 14 (of 14 total)
  • The topic ‘24 hour format inside WordPress’ is closed to new replies.