Title: break up date variable
Last modified: August 19, 2016

---

# break up date variable

 *  [zakgreene](https://wordpress.org/support/users/zakgreene/)
 * (@zakgreene)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/break-up-date-variable/)
 * 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?

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael Fields](https://wordpress.org/support/users/mfields/)
 * (@mfields)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/break-up-date-variable/#post-955474)
 *     ```
       <span class="day"><?php the_time( 'D' ); ?></span>
       <span class="month"><?php the_time( 'M' ); ?></span>
       <span class="year"><?php the_time( 'Y' ); ?></span>
       ```
   
 *  Thread Starter [zakgreene](https://wordpress.org/support/users/zakgreene/)
 * (@zakgreene)
 * [17 years, 5 months ago](https://wordpress.org/support/topic/break-up-date-variable/#post-955598)
 * I figured it would probably be that easy. Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘break up date variable’ is closed to new replies.

## Tags

 * [date](https://wordpress.org/support/topic-tag/date/)
 * [formatting](https://wordpress.org/support/topic-tag/formatting/)
 * [variable](https://wordpress.org/support/topic-tag/variable/)

 * 2 replies
 * 2 participants
 * Last reply from: [zakgreene](https://wordpress.org/support/users/zakgreene/)
 * Last activity: [17 years, 5 months ago](https://wordpress.org/support/topic/break-up-date-variable/#post-955598)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
