Eureka Moment Wiki

One eureka moment at the time

User Tools

Site Tools


development:php:date

PHP datetime

$EndDate = date_create(%MYSQL DATETIME FORMAT%);
date_add($EndDate,new DateInterval('P7D')); //Add 7 days
$Now = date_create(date('Y-m-d H:i:s'));
//$DiffDate = date_diff($Now,$EndDate); //Returns larger-than-zero integer
//echo $DiffDate->format('%d');
if ($EndDate>$Now) {
    $Larger=true;
} else {
    $Larger=false;
}
development/php/date.txt · Last modified: 2018/09/06 09:54 by tplecko