หมวด บอร์ดพิเศษ
=> สนทนาประสาช่าง - ข่าวสารทั่วไป => ข้อความที่เริ่มโดย: staff th-net ที่ 10 กรกฎาคม 2557, เวลา 22:04:19 น.

หัวข้อ: smf เปลี่ยนปี คศ. เป็น พศ.
เริ่มหัวข้อโดย: staff th-net ที่ 10 กรกฎาคม 2557, เวลา 22:04:19 น.
[attach=1]

smf เปลี่ยนปี คศ. เป็น พศ.


เข้าไปที่...
.../ Sources/ Subs.php

ค้นหาคำว่า...
โค๊ด: [เลือก]
// Do-it-yourself time localization.  Fun.
เอาโค้ดนี้...วางก่อนหน้า
โค๊ด: [เลือก]
// Convert Common Era (C.E.) into Buddhist Era (B.E., aka Thai year)
    $time_array = getdate( $time );
    $str = str_replace( '%y', ( $time_array['year'] + 543 ) % 100, $str );
    $str = str_replace( '%Y', $time_array['year'] + 543, $str );


ค้นหาต่อที่คำว่า...
โค๊ด: [เลือก]
if (setlocale(LC_TIME, $txt['lang_locale']))
  {
    foreach (array('%a', '%A', '%b', '%B') as $token)
      if (strpos($str, $token) !== false)
        $str = str_replace($token, $func['ucwords'](strftime($token, $time)), $str);

หรือถ้าด้านบนไม่มี ก็อันนี้
โค๊ด: [เลือก]
if (setlocale(LC_TIME, $txt['lang_locale']))
{
if (!isset($non_twelve_hour))
$non_twelve_hour = trim(strftime('%p')) === '';
if ($non_twelve_hour && strpos($str, '%p') !== false)
$str = str_replace('%p', (strftime('%H', $time) < 12 ? $txt['time_am'] : $txt['time_pm']), $str);

foreach (array('%a', '%A', '%b', '%B') as $token)
if (strpos($str, $token) !== false)
$str = str_replace($token, !empty($txt['lang_capitalize_dates']) ? $smcFunc['ucwords'](strftime($token, $time)) : strftime($token, $time), $str);



แล้วเอาโค้ดนี้...วางต่อท้าย
โค๊ด: [เลือก]
// Convert Common Era (C.E.) into Buddhist Era (B.E., aka Thai year)
        $str = str_replace('%y', (strftime('%y', $time)+543)%100, $str);
        $str = str_replace('%Y', strftime('%Y', $time)+543, $str);


แล้วเข้าไปปรับแต่งให้แสดงผลเป็นรูปแบบวันที่ตามที่เราต้องการ เช่น 14 มกราคม 2556 ,เวลา 20:48:57 น.
ผู้ดูแลระบบ -> ส่วนปรับแต่งค่าการใช้งาน -> รูปแบบเวลาปกติ %d %B %Y ,เวลา %H:%M:%S น.




ที่มา...
www.gpsteawthai.com (http://www.gpsteawthai.com/index.php?topic=1790.0)
www.zone-it.com (http://www.zone-it.com/51766)
www.question.in.th (http://www.question.in.th/%E0%B9%80%E0%B8%9B%E0%B8%A5%E0%B8%B5%E0%B9%88%E0%B8%A2%E0%B8%99%E0%B8%9B%E0%B8%B5%E0%B8%84%E0%B8%A8%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99%E0%B8%9B%E0%B8%B5%E0%B8%9E%E0%B8%A8%E0%B9%80%E0%B8%9B%E0%B8%A5%E0%B8%B5%E0%B9%88%E0%B8%A2%E0%B8%99%E0%B9%80%E0%B8%9B%E0%B9%87%E0%B8%99%E0%B8%9B%E0%B8%B5%E0%B9%84%E0%B8%97%E0%B8%A2%E0%B8%AA%E0%B8%B3%E0%B8%AB%E0%B8%A3%E0%B8%B1%E0%B8%9A%E0%B8%9A%E0%B8%AD%E0%B8%A3%E0%B9%8C%E0%B8%94smf-87.html)
หัวข้อ: Re: smf เปลี่ยนปี คศ. เป็น พศ.
เริ่มหัวข้อโดย: chaadchai ที่ 29 กรกฎาคม 2557, เวลา 14:04:41 น.
erroe อ่าครับ
หัวข้อ: Re: smf เปลี่ยนปี คศ. เป็น พศ.
เริ่มหัวข้อโดย: staff th-net ที่ 04 กันยายน 2557, เวลา 07:16:43 น.
erroe อ่าครับ

!?
หัวข้อ: Re: smf เปลี่ยนปี คศ. เป็น พศ.
เริ่มหัวข้อโดย: Viroonna (ลิ้งค์พนัน) ที่ 27 กันยายน 2557, เวลา 10:17:05 น.
ข้อมูลน่าสนครับจะลองทำตามดูนะครับ
หัวข้อ: Re: smf เปลี่ยนปี คศ. เป็น พศ.
เริ่มหัวข้อโดย: gbienegjoja (ลิ้งค์พนัน) ที่ 30 กันยายน 2557, เวลา 17:19:43 น.
ดีจังแจกโค้ดเปี่ยนให้ด้วยอิอิ
หัวข้อ: Re: smf เปลี่ยนปี คศ. เป็น พศ.
เริ่มหัวข้อโดย: sollwll (ลิ้งค์พนัน) ที่ 24 ตุลาคม 2557, เวลา 15:35:43 น.
กว่าจะทำได้ยากมากๆๆ