Mini Shell

Direktori : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/admin/
Upload File :
Current File : /var/www/vhosts/ccp.ac.th/smtp.ccp.ac.th/httpdocs/new/admin/function_date.php

       <?php 

         function displaydate ($x) {
           $date_m=array ("มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤษจิกายน","ธันวาคม");

           $date_array=explode("-",$x);
           $y=$date_array[0]+543;
           $m=$date_array[1]-1;
           $d=$date_array[2];
           $m=$date_m[$m];
           $displaydate="$d $m $y";
           return $displaydate;
            } 
      
       ?> 
      <?php
 function mydate($strDate){
    list($Y,$m,$d) = explode("/",$strDate); // แยกข้อความด้วยตัวแบ่ง
    $Y = $Y-543; // จัดรูปแบบปีเป็น ค.ศ. ลบ 543
    $m = sprintf("%'.02d",$m); // จัดรูปแบบเดือน 00
    $d = sprintf("%'.02d",$d); // จัดรูปแบบวัน 00
    $strDate_new = implode("-",array($Y,$m,$d));
    // $strDate_new = "$Y-$m-$d"; // แบบนี้ก็ได้
    return $strDate_new; // ตัวแปรที่ส่งค่ากลับ   
}
 ?> 


Zerion Mini Shell 1.0