PHP Expiry day : How to convert datetime(mysql) to mktime of php

 function getMktimeNumber($type,$date)

    {

        if($type > 0)

        {

            $convert = strtotime($date);

            $times = date(“H,i,s,m,d,Y”,$convert);

        }

        else

        {

            $times = date(“H,i,s,m,d,Y”,time());

        }

        $cut = explode(“,”,$times);

        $time_number = mktime($cut[0] , $cut[1] , $cut[2] , $cut[3] , $cut[4] , $cut[5]  );

        return $time_number;

    }

$start_time = ‘2023-11-15 11:01:19’;

$untilDay = 3 ;

$time1 = $this->getMktimeNumber(1,$start_time]);        // Start date

$time2 = $this->getMktimeNumber(0,time());                   // Now date

$time3 = $time1 + ( (3600*24)* ($untilDay*1) );     // Expiry date

if( $time2 >= $time3 )

{

exit;

}

답글 남기기

이메일 주소는 공개되지 않습니다. 필수 필드는 *로 표시됩니다