Support » Themes and Templates » Problem with the_time – Showing Y-m-d in browser

  • Hi!

    I have a loop, like this:

    <?php query_posts('cat=4');?>
    <?php while (have_posts()) : the_post();?>
    <?php the_title();?>
    <?php the_time(' Y-m-d, H:i'); ?>
    <?php endwhile;?>
    <?php wp_reset_query();?>

    Im using it to make a list of recent news. The title of the news (from the_title) is showing up in the browser. But the problem is that the date, from the_time, isn’t showing up as date, it’s showing up as Y-m-d H:i IN THE BROWSER?!

    I have tried to place my the_time -function in other loops in my theme and in other template files, I have even tried to look at the theme in other browsers like chrome, IE9 and firefox. I get the same problem every time. I also tried to use the php function date, to show the actual date like this:

    <?php echo date(' Y-m-d, H:i'); ?>

    That works properly, showing the recent time/date.

    I have also tried to use the_time function and the_date function in wordpress without giving it any formatting characters. At that time, the function is working.

    What is wrong? Why can’t I format the function the_time?

    I appriaciate your help


Viewing 8 replies - 1 through 8 (of 8 total)
  • Change <?php the_time(' Y-m-d, H:i'); ?> to <?php the_time(); ?>

    I have done that, it gives me the formatting 11:05 (the time of the post), so with that syntax it’s working, but I would like to format the_time different at different pages.

    I’m glad you wanna help, but I have already tried that :/

    I really wanna format the_time as I want it…

    Try <?php the_date('Y-m-d'); ?>, <?php the_time('H:i'); ?>

    Im sorry esmi, I have tried that also, it seems like it doesn’t matter what I place between parentheses, the html does always only display whats inside the parentheses :S

    <?php the_time('Y-m-d, H:i'); ?> works fine for me. It displays the date & time – not Y-m-d, H:i.

    Yeah, I have done it many times before on other themes I’ve made, but this time it’s not working, but I can’t figure out why…

    Perhaps there’s another issue in that template or theme? Or a plugin is causing a problem?

    Yes that have crossed my mind also, think I’m gonna deactivate all my plugins and see if that helps, writing here again when I’ve done that!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Problem with the_time – Showing Y-m-d in browser’ is closed to new replies.