Viewing file: f_thaidate.php (1.55 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php date_default_timezone_set('Asia/Bangkok'); function DateThai($strDate) { $strYear = date("Y",strtotime($strDate))+543; $strMonth= date("n",strtotime($strDate)); $strDay= date("j",strtotime($strDate)); //$strHour= date("H",strtotime($strDate)); //$strMinute= date("i",strtotime($strDate)); //$strSeconds= date("s",strtotime($strDate)); $strMonthCut = Array("","มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม"); $strMonthThai=$strMonthCut[$strMonth]; return "$strDay $strMonthThai $strYear"; //return "$strDay $strMonthThai $strYear, $strHour:$strMinute"; } function new_update($str_start, $str_end) //รับค่ามาสองค่าคือ เริ่ม กับ จบ { $str_start = strtotime($str_start); // ทำวันที่ให้อยู่ในรูปแบบ timestamp $str_end = strtotime($str_end); $nseconds = $str_start-$str_end; // วันที่ระหว่างเริ่มและสิ้นสุดมาลบกัน $ndays = round($nseconds / 86400); // ทำให้เป็นจำนวนวันหารด้วย 86400 วินาทีปัดเศษทศนิยม return $ndays; } $timeset = 7; // กำหนดเวลาในการแสดงข้อความ นับเป็นวัน ?>
|