Title: Resolving a Variable Issue Date
Last modified: August 19, 2016

---

# Resolving a Variable Issue Date

 *  [steveniweiss](https://wordpress.org/support/users/steveniweiss/)
 * (@steveniweiss)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/resolving-a-variable-issue-date/)
 * I need every post on a site to be prefaced with the date as though it were published
   on Friday, even though it’s not. It can be safely assumed that the post in question
   would never be published on any day other than Wednesday, Thursday, or Friday.
 * Basically, whatever date the article is published, unless it’s a Friday, the 
   algorithm will look for the Friday that comes after the publishing date of a 
   post, and store that in a variable that can be echoed.
 * Let’s say it starts with the following:
    `$publishdate = the_date ('l, F j, Y',
   false);` `$publishday = explode (' ', $publishdate);` `if $publishday[0] = "Friday":
   echo $publishdate;`
 * Here’s where it gets a lot more messy, at least with straightforward code, especially
   when the month changes between Wednesday/Thursday and Friday. Is there a function
   in WordPress for just adding to a given date?

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

 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/resolving-a-variable-issue-date/#post-1961442)
 * Might something like this work:
 *     ```
       $publish_day = the_date( 'l' );
       $days_to_add = '+0 days';
       if ( 'thursday' = $publish_day ) {
            $days_to_add = '+1 day';
       } elseif ( 'wednesday' = $publish_day ) {
            $days_to_add = '+2 days';
       }
       $actual_publish_date = the_date( get_option( 'date_format' ) );
       $displayed_publish_date = strtotime ( $days_to_add , strtotime ( $actual_publish_date ) ) ;
       ```
   
 * Then, to output the “shifted” publish date:
 *     ```
       echo $displayed_publish_date;
       ```
   
 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/resolving-a-variable-issue-date/#post-1961444)
 * Whoops!
 * Replace:
 *     ```
       $publish_day = the_date( 'l' );
       ```
   
 * With:
 *     ```
       $publish_day = get_the_date( 'l' );
       ```
   
 * And replace:
 *     ```
       $actual_publish_date = the_date( get_option( 'date_format' ) );
       ```
   
 * With:
 *     ```
       $actual_publish_date = get_the_date( get_option( 'date_format' ) );
       ```
   
 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [15 years, 2 months ago](https://wordpress.org/support/topic/resolving-a-variable-issue-date/#post-1961447)
 * I found another mistake. (Off my game today.)
 *     ```
       $publish_day = get_the_date( 'l' );
       $days_to_add = '0';
       if ( 'thursday' = $publish_day ) {
            $days_to_add = '1';
       } elseif ( 'wednesday' = $publish_day ) {
            $days_to_add = '2';
       }
       $date_shift = '+' . $days_to_add . ' day';
       $actual_publish_date = get_the_date( get_option( 'date_format' ) );
       $displayed_publish_date = strtotime ( $date_shift , strtotime ( $actual_publish_date ) ) ;
       ```
   

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

The topic ‘Resolving a Variable Issue Date’ is closed to new replies.

## Tags

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

 * 3 replies
 * 2 participants
 * Last reply from: [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * Last activity: [15 years, 2 months ago](https://wordpress.org/support/topic/resolving-a-variable-issue-date/#post-1961447)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
