Support » Fixing WordPress » the_time() problems display Today, Yesterday

  • In my template, I’m trying to display:

    Today, June 17th, 2005
    Yesterday, June 16th, 2005
    Wednesday, June 15th, 2005

    to the template, but I seem to be having a problem with the_time() function.

    here is my code..

    $today = date(“Ymd”);
    $yesterday = date(“Ymd”, time() – 86400);
    $mtdate = the_time(‘Ymd’);

    if ($mtdate==$today) {
    echo (‘Today, ‘);
    the_time(‘F j, Y’);
    elseif ($mtdate==$yesterday) {
    echo (‘Yesterday, ‘);
    the_time(‘F j, Y’);
    else {
    the_time(‘l, F j, Y’);

    This therectically should work, but for some reason its displaying like this instead:

    20050617Friday, June 17th, 2005

    instead. Is there a way to fix this?


Viewing 1 replies (of 1 total)
  • nevermind, its

    $mtdate = get_the_time(‘Ymd’);
    instead of
    $mtdate = the_time(‘Ymd’);

    welllll, I was close…LOL

Viewing 1 replies (of 1 total)
  • The topic ‘the_time() problems display Today, Yesterday’ is closed to new replies.