Exemplo n.º 1
0
 /**
  *
  * @param WpSubscription $subscription
  * @return string MySQL DATETIME string format 
  */
 public static function calculateNextDateExpiresFromSubscription($subscription)
 {
     // contains the needed day/hour/minute/second
     $end = date_create_from_format('Y-m-d H:i:s', $subscription->getEnd(), new DateTimeZone('GMT'));
     $now = new DateTime('now', new DateTimeZone('GMT'));
     $expire = date_create_from_format('Y-m-d H:i:s', $now->format('Y-m-') . $end->format('d H:i:s'), new DateTimeZone('GMT'));
     if ($expire < $now) {
         $expire->modify('+1 month');
     }
     return $expire->format('Y-m-d H:i:s');
 }