Question: I'm in the process of making wordpress plugin using PHP. The objective is that the plugin will run until a stated date, than it will stop.

The problem is, let say I stated the expired date is on 16/9/2012. The system will only stop the plugin on 17/9/2012 08:00AM. How can I make it stop at 17/9/2012 12:00AM.

The coding that correspond are shown below. Need your advice. Thanks!

```
function display($content) {

$exp_date = "16-09-2012";
$todays_date = date("d-m-Y");

$today = strtotime($todays_date);
$expiration_date = strtotime($exp_date);

if ($expiration_date >= $today) {
    return flag().$content;

} else {
        return $content;
    }
}

```

Answer: 
Better to use "mktime()" to make timestamp of expiry date. Then you can compare with current time stamp which you can get by function "time()".

For example

```
$exp_date = mktime(23,59,59,9,16,2012);
if(time() > $exp_date){

 // expired

} else {

  // Not expired.

}

```
```
$exp_date = "16-09-2012";
$todays_date = date("d-m-Y");

$today = strtotime($todays_date); 
$expiration_date = strtotime($exp_date);

```

Can be improved for readability and comfort into 

```
$exp_date = "16-09-2012";

$today = new DateTime('now', new DateTimezone('UTC'));
$expiration_date = new DateTime($exp_date,new DateTimezone('UTC');//can be other timezone

```

With DateTime, you can do comparison with >, <, >=, <= like with timestamp, but your using something that has the meaning of "date", not an integer.