Support » Fixing WordPress » Date not displaying as I have told it to format

  • I’m using the default template for wordpress ( ) I’m going to change the layout, but first I want to get the code workin properly. Right now the date, no matter what I change it to in the control panel, always shows up as the defaulted way. May 02, 2005. I currently have it set to “m.d.y” which should be 05.02.05 Does anyone know what is going wrong or how I can fix it? I have checked the database and it has “m.d.y” in it just like the control panel shows. I don’t know what’s going on. Any help? Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Unfortunately it is hardcoded in the index.php of the default theme… around line 11.

    (Why? That’s a real good question.)

    You’ll need to edit several templates, actaully, to *correct* this: index.php, archive.php single.php and search.php. In each, look for where the template tag the_time() is used. For example, from index.php:

    <?php the_time('F jS, Y') ?>

    Note the use of the PHP date format characters. From here you have at least three options:

    1. Customize the format characters to how you want your date displayed.

    2. Remove the parameter (i.e. the_time();), and change the format string for “Default time format” in WordPress to the date format you want. This will work, but not recommended (since it will hit all uses of the_time() that use the WordPress setting).

    3. Use the get_settings() function with the_time() like this:

    <?php the_time(get_settings('date_format')); ?>

    This will pass along the format string for your “Default date format” setting.

    Well, I think this is still ridiculous 🙂
    The date format should be set in one place only as a default format and used by all time functions. If there is a reason I don’t see ( very fresh at PHP ) for having different formats for the administrator and the readers, one could implement a certain format string for admin, set separately in the DashBoard options.

    Well, it’s up to the theme developer, just as the choice of template files is. If you don’t like the default, you can switch themes or edit Kubrick. A lot of themes use the control panel setting, but they can (as in this case) override it by specifying the date format.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Date not displaying as I have told it to format’ is closed to new replies.