$dayTH = Array('อาทิตย์','จันทร์','อังคาร','พุธ','พฤหัสบดี','ศุกร์','เสาร์'); $monthTH = Array(null,'มกราคม','กุมภาพันธ์','มีนาคม','เมษายน','พฤษภาคม','มิถุนายน','กรกฎาคม','สิงหาคม','กันยายน','ตุลาคม','พฤศจิกายน','ธันวาคม'); $monthTH_brev = Array(null,'ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.','ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.'); function thai_date($time){ // 19 ธันวาคม 2556 global $dayTH,$monthTH; $thai_date_return = date("j",$time); $thai_date_return.=" ".$monthTH[date("n",$time)]; $thai_date_return.= " ".(date("Y",$time)+543); // $thai_date_return.= " เวลา ".date("H:i:s",$time); return $thai_date_return; } function thai_date_p($time){ // 19 ธันวาคม 2556 global $dayTH,$monthTH; $thai_date_return = date("j",$time); // $thai_date_return.=" "; $thai_date_return.=" ".$monthTH[date("n",$time)]; $thai_date_return.= " พ.ศ. ".(date("Y",$time)+543); // $thai_date_return.= " เวลา ".date("H:i:s",$time); return $thai_date_return; } function thai_month($time){ // ธันวาคม 2556 global $dayTH,$monthTH; // $thai_date_return = date("j",$time); $thai_date_return.=" ".$monthTH[date("n",$time)]; $thai_date_return.= " ปี ".(date("Y",$time)+543); // $thai_date_return.= " เวลา ".date("H:i:s",$time); return $thai_date_return; } function thai_date_and_time($time){ // 19 ธันวาคม 2556 เวลา 10:10:43 global $dayTH,$monthTH; $thai_date_return = date("j",$time); $thai_date_return.=" ".$monthTH[date("n",$time)]; $thai_date_return.= " ".(date("Y",$time)+543); $thai_date_return.= " เวลา ".date("H:i:s",$time); return $thai_date_return; } function thai_date_and_time_short($time){ // 19 ธ.ค. 2556 10:10:4 global $dayTH,$monthTH_brev; $thai_date_return = date("j",$time); $thai_date_return.=" ".$monthTH_brev[date("n",$time)]; $thai_date_return.= " ".(date("Y",$time)+543); $thai_date_return.= " ".date("H:i:s",$time); return $thai_date_return; } function thai_date_short($time){ // 19 ธ.ค. 2556a global $dayTH,$monthTH_brev; $thai_date_return = date("j",$time); $thai_date_return.=" ".$monthTH_brev[date("n",$time)]; $thai_date_return.= " ".(date("Y",$time)+543); return $thai_date_return; } function thai_date_fullmonth($time){ // 19 ธันวาคม 2556 global $dayTH,$monthTH; $thai_date_return = date("j",$time); $thai_date_return.=" ".$monthTH[date("n",$time)]; $thai_date_return.= " ".(date("Y",$time)+543); return $thai_date_return; } function thai_date_short_number($time){ // 19-12-56 global $dayTH,$monthTH; $thai_date_return = date("d",$time); $thai_date_return.="-".date("m",$time); $thai_date_return.= "-".substr((date("Y",$time)+543),-2); return $thai_date_return; } function thai_date_number($time){ // 19-12-2020 global $dayTH,$monthTH; $thai_date_return = date("n",$time); $thai_date_return.="/".date("m",$time); $thai_date_return.= "/".date("Y",$time); return $thai_date_return; } function date_format_to_databese($date) { return date('Y-m-d H:i:s', strtotime($date)); } function expdate($startdate,$datenum){ $startdatec=strtotime($startdate); // ทำให้ข้อความเป็นวินาที $tod=$datenum*86400; // รับจำนวนวันมาคูณกับวินาทีต่อวัน $ndate=$startdatec+$tod; // นับบวกไปอีกตามจำนวนวันที่รับมา return $ndate; // ส่งค่ากลับ } $dayEN = Array('Sunday','Monday','Tueday','Wednesday','Thursday','Friday','Saturday'); $monthEN = Array(null,'January','February','March','April','May','June','July','August','September','October','November','December'); //$monthEN_brev = [null,'ม.ค.','ก.พ.','มี.ค.','เม.ย.','พ.ค.','มิ.ย.','ก.ค.','ส.ค.','ก.ย.','ต.ค.','พ.ย.','ธ.ค.']; function eng_date($time){ // 19 ธันวาคม 2556 global $dayEN,$monthEN; $en_date_return = $monthEN[date("n",$time)]; $en_date_return.=" ".date("j",$time); $en_date_return.= ", ".(date("Y",$time)); // $thai_date_return.= " เวลา ".date("H:i:s",$time); return $en_date_return; } ?>