Reputation: 509
Hello I want to set condition that once the post is already posted 30mins up will not able to edit or customize.
My timespan codes:
<?php
$post_date = $threads['created_at'];
$now = time();
echo timespan($post_date, $now, 1). ' '.lang_key('ago') ?>
I want to have a condition something like this:
Note this code is a sample only.
<?php if(timespan >= '30 mins'){
//disable the edit button
}else{
//enable the edit button
} ?>
Upvotes: 1
Views: 53
Reputation: 9265
Assuming a well formed timestamp you can do:
if (strtotime($threads['created_at']) < strtotime("-30 minutes")) {
echo ' is older than 30 mins';
} else {
echo ' is not older than 30 mins';
}
Upvotes: 1