แปลง timestamp ให้เป็นรูปแบบวันที่ภาษาไทย ติดตรงปี พ.ศ. ที่ยังไม่ได้
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา แปลง timestamp ให้เป็นรูปแบบวันที่ภาษาไทย ติดตรงปี พ.ศ. ที่ยังไม่ได้
แปลง timestamp ให้เป็นรูปแบบวันที่ภาษาไทย ติดตรงปี พ.ศ. ที่ยังไม่ได้
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | <?php $thai_day_arr = array ( "อาทิตย์" , "จันทร์" , "อังคาร" , "พุธ" , "พฤหัสบดี" , "ศุกร์" , "เสาร์" ); $thai_month_arr = array ( "0" => "" , "1" => "มกราคม" , "2" => "กุมภาพันธ์" , "3" => "มีนาคม" , "4" => "เมษายน" , "5" => "พฤษภาคม" , "6" => "มิถุนายน" , "7" => "กรกฎาคม" , "8" => "สิงหาคม" , "9" => "กันยายน" , "10" => "ตุลาคม" , "11" => "พฤศจิกายน" , "12" => "ธันวาคม" ); $thai_month_arr_short = array ( "0" => "" , "1" => "ม.ค." , "2" => "ก.พ." , "3" => "มี.ค." , "4" => "เม.ษ." , "5" => "พ.ค." , "6" => "มิ.ย." , "7" => "ก.ค." , "8" => "ส.ค." , "9" => "ก.ย." , "10" => "ต.ค." , "11" => "พ.ย." , "12" => "ธ.ค." ); function thai_date_and_time( $time ){ // 19 ??????? 2556 ???? 10:10:43 global $thai_day_arr , $thai_month_arr ; $thai_date_return .= date ( "j" , $time ); $thai_date_return .= " " . $thai_month_arr [ 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 $thai_day_arr , $thai_month_arr_short ; $thai_date_return .= date ( "j" , $time ); $thai_date_return .= " " . $thai_month_arr_short [ 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 ?.?. 2556 global $thai_day_arr , $thai_month_arr_short ; $thai_date_return .= date ( "j" , $time ); $thai_date_return .= " " . $thai_month_arr_short [ date ( "n" , $time )]; $thai_date_return .= " " .( date ( "Y" , $time )+543); return $thai_date_return ; } function thai_date_fullmonth( $time ){ // 19 ??????? 2556 global $thai_day_arr , $thai_month_arr ; $thai_date_return .= date ( "j" , $time ); $thai_date_return .= " " . $thai_month_arr [ date ( "n" , $time )]; $thai_date_return .= " " .( date ( "Y" , $time )+543); return $thai_date_return ; } function thai_date_short_number( $time ){ // 19-12-56 global $thai_day_arr , $thai_month_arr ; $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 ; } |
1 2 3 4 5 | //$dateData="2559-6-14"; $dateData = "2016-6-14" ; echo thai_date_and_time( strtotime ( $dateData )); ?> |

คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
ความคิดเห็นที่
1
ดูเนื้อหานี้เป็นแนวทาง
แนวทางการจัดรูปแบบข้อความวันที่ ให้อยู่ในรูปแบบมาตรฐาน ใน php
https://www.ninenik.com/content.php?arti_id=802 via @ninenik

ความคิดเห็นที่
2
ขอบคุณครับ.

ขอบคุณทุกการสนับสนุน
![]()