# Calculate an Expiry Date in PHP

**URL:** <https://forum.kirupa.com/t/calculate-an-expiry-date-in-php/221574>\
**Category:** programming\
**Created:** [April 5, 2007, 10:43am UTC](https://forum.kirupa.com/t/calculate-an-expiry-date-in-php/221574 "2007-04-05T10:43:48Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![onemhunki](https://avatars.discourse-cdn.com/v4/letter/o/c57346/32.png) [@onemhunki](https://forum.kirupa.com/u/onemhunki)\
**Post date:** [April 5, 2007, 10:43am UTC](https://forum.kirupa.com/t/calculate-an-expiry-date-in-php/221574/1 "2007-04-05T10:43:48Z")

</div>

Hi folks, have the following in a script

```php

if(eregi('3', $member_level)) {
$months = 3;
}elseif(eregi('6', $member_level)) {
$months = 6;
}elseif(eregi('12', $member_level)) {
$months = 12;
}
$date_joined = $row['date_joined'];
$expiry_date = date('Y-m-d', strtotime('+3 months'));

```

Basically I query the membership level to find out if they have signed up for a 3 month, 6 months or 12 month period. Then I need to add this to the their date\_joined to find out the date their membership expires.

Anyone out there help me solve this
