Title: Customizing date display
Last modified: August 19, 2016

---

# Customizing date display

 *  Resolved [Aen](https://wordpress.org/support/users/aen/)
 * (@aen)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/customizing-date-display/)
 * I want to display month only in the last post of the month and every post to 
   have the day. LIke:
 * Feb 19: Title
    12: Title 05: Title 01: Title Mar 23: Title 17: Title so on…
 * Any ideas?

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

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/customizing-date-display/#post-1392607)
 * Before your [loop](http://codex.wordpress.org/The_Loop) put this:
 *     ```
       <?php
       $last_date='';
       ?>
       ```
   
 * Then inside your loop put
 *     ```
       <?php
       $current_post_ym = get_the_time('Ym');
       if ( $last_date != $current_post_ym ) {
         $last_date = $current_post_ym;
         $display_date = get_the_time('M d');
       } else {
         $display_date = get_the_time('d');
       }
       ?>
       <p><?php echo $display_date .':'; ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
       ```
   
 *  Thread Starter [Aen](https://wordpress.org/support/users/aen/)
 * (@aen)
 * [16 years, 1 month ago](https://wordpress.org/support/topic/customizing-date-display/#post-1392621)
 * Works great! Thanks Michael!

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

The topic ‘Customizing date display’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [Aen](https://wordpress.org/support/users/aen/)
 * Last activity: [16 years, 1 month ago](https://wordpress.org/support/topic/customizing-date-display/#post-1392621)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
