Title: Converting a date with PHP
Last modified: August 21, 2016

---

# Converting a date with PHP

 *  [SpicyNumberOne](https://wordpress.org/support/users/spicynumberone/)
 * (@spicynumberone)
 * [12 years, 11 months ago](https://wordpress.org/support/topic/converting-a-date-with-php/)
 * In a plugin my colleague made, we’ve successfully made a date display for an 
   event by writing:
 *     ```
       <?php if ($display_date = get_post_meta($post->ID, 'start-date', true)): ?>
   
       <?php echo $display_date;?> <!--  the page displays 07-15-13  -->
   
       <?php endif;?>
       ```
   
 * but, I want to convert those impersonal digits to Monday, July 15, 2013. Now,
   I know all about ‘l, F jS, Y’ PHP, but when I try to put ‘l, F jS, Y’ and that
   sort of thing, I get Monday, January 1, 1970. Here is what I inserted trying 
   to find a solution:
 *     ```
       <?php if ($display_date = date('l, F jS, Y', strtotime(get_post_meta($post->ID, 'start-date', true)))): ?> <!-- This does not work, it does not pick up the actual 'start_date' -->
       ```
   
 * How do I grab the start date and convert the way the date displays at the same
   time?

The topic ‘Converting a date with PHP’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [SpicyNumberOne](https://wordpress.org/support/users/spicynumberone/)
 * Last activity: [12 years, 11 months ago](https://wordpress.org/support/topic/converting-a-date-with-php/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
