<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
</head>

<body>
    <?php 
        $qdate="2021-07-10";
        $date=date($qdate);
        echo $date."<br>";
        echo substr($date,2,2)."<br>";
        echo date('Y')."<br>";

        //(date("Y") == date_format($year,'Y'))
        echo date('Y').'<br>';
        $year=('2021-09-28');
        echo date($year).'<br>'; //ทำให้เป็น date
        echo $year.'<br>';       //String 
        echo substr($year,0,4)."<br>";
        if(date('Y')===substr($year,0,4)){
            echo "Yes";}
        echo '<hr>'; 

        $year='2021-09-28'; 
        $ono='2109000012';    
        $rows=0;    
        if (date("Y") == substr($year,0,4)) 
        {
            $num = substr($ono, 4, 6) + 1;
        } 
        else {$num = 1;}
        echo 'Num is : '.$num;  
        echo '<hr>';
        $d=date('Y-m-d');
        $date=new DateTime($d);
        echo $date->format('d/m/Y').'<br>'; 
        
        //$date = new DateTime('2000-01-01'); // $date_order
        //echo $date->format('m/d/Y');
        $time=strtotime('2021-09-28');
        echo $time.'<br>';    
        echo DATE('d-m-Y',$time);

        echo '<hr>';
        echo "-----------";
        echo '<hr>';
        echo "Current Year is : ".date('y');

    ?>
</body>
</html>