Forums

break up date variable (3 posts)

  1. zakgreene
    Member
    Posted 3 years ago #

    I'm trying to format each piece of the date into seperate spans/divs, as such:

    <span>5</span> <div>Jan</div> <div>2009</div>

    Have never used php, but am vaguely familiar with programming in Javascript, etc. I tried this, didn't work:

    <?php
    $date = "</span> <div class=\"month\">";
    $month = "</div> <div class=\"year\">";
    the_date('j' + $date + 'M' + $month + 'Y', '<h2><span class="date">', '</div></h2>');
    ?>

    The variables were ignored. The end result was <h2><span class="date">5 Jan 2009</div></h2>

    Any ideas?

  2. Michael Fields
    Theme Wrangler
    Posted 3 years ago #

    <span class="day"><?php the_time( 'D' ); ?></span>
    <span class="month"><?php the_time( 'M' ); ?></span>
    <span class="year"><?php the_time( 'Y' ); ?></span>
  3. zakgreene
    Member
    Posted 3 years ago #

    I figured it would probably be that easy. Thanks!

Topic Closed

This topic has been closed to new replies.

About this Topic