|
The problem is because I have one file in language folder to change date format from English style to Thai style.. I can't upload the file here.. but I copy script to shoow you... <?php /** * @version $Id: date.php 9966 2008-01-27 16:30:40Z willebil $ * @package Joomla.Framework * @subpackage Utilities * @copyright Copyright (C) 2005 - 2008 Open Source Matters. All rights reserved. * @license GNU/GPL, see LICENSE.php * Joomla! is free software. This version may have been modified pursuant * to the GNU General Public License, and as distributed it includes or * is derivative of works licensed under the GNU General Public License or * other free or open source software licenses. * See COPYRIGHT.php for copyright notices and details. */
// Check to ensure this file is within the rest of the framework defined('JPATH_BASE') or die();
/** * JDate is a class that stores a date * * @author Johan Janssens <johan.janssens@joomla.org> * * @package Joomla.Framework * @subpackage Utilities * @since 1.5 */ class JDateth_TH extends JDate { /** * Unix timestamp * * @var int|boolean * @access protected */ var $_date = false;
/** * Time offset (in seconds) * * @var string * @access protected */ var $_offset = 0;
/** * Creates a new instance of JDate representing a given date. * * Accepts RFC 822, ISO 8601 date formats as well as unix time stamps. * If not specified, the current date and time is used. * * @param mixed $date optional the date this JDate will represent. * @param int $tzOffset optional the timezone $date is from */ function __construct($date = 'now', $tzOffset = 0) { parent::__construct($date, $tzOffset); }
/** * Gets the date in a specific format * * Returns a string formatted according to the given format. Month and weekday names and * other language dependent strings respect the current locale * * see manual #PHP_DATE http://th.php.net/manual/en/function.date.php * @param string $format The date format specification string (see {@link PHP_MANUAL#strftime}) * @return a date in a specific format */ function toFormat($format = '%Y-%m-%d %H:%M:%S') { $convNumber = true; $date = ($this->_date !== false) ? $this->th_THdate($format, $this->_date + $this->_offset,$convNumber) : null; return $date; } function th_THdate($format, $time,$convNumber) { $format = str_replace('%a', $this->_dayToString(date('w', $time), true), $format); $format = str_replace('%A', $this->_dayToString(date('w', $time)), $format); $format = str_replace('%b', $this->_monthToString(date('n', $time), true), $format); $format = str_replace('%B', $this->_monthToString(date('n', $time)), $format); $format = str_replace('%Y', $this->_yearToString(date('Y', $time), $convNumber), $format); $format = str_replace('%d', $this->_numToString(date('d', $time), $convNumber), $format); $format = str_replace('%h', $this->_numToString(date('h', $time), $convNumber), $format); $format = str_replace('%H', $this->_numToString(date('H', $time), $convNumber), $format); $format = str_replace('%i', $this->_numToString(date('i', $time), $convNumber), $format); return $format; } function _monthToString($month, $abbr = false) { switch ($month) { case 1: return $abbr ? JText::_('JANUARY_SHORT') : JText::_('JANUARY'); case 2: return $abbr ? JText::_('FEBRUARY_SHORT') : JText::_('FEBRUARY'); case 3: return $abbr ? JText::_('MARCH_SHORT') : JText::_('MARCH'); case 4: return $abbr ? JText::_('APRIL_SHORT') : JText::_('APRIL'); case 5: return $abbr ? JText::_('MAY_SHORT') : JText::_('MAY'); case 6: return $abbr ? JText::_('JUNE_SHORT') : JText::_('JUNE'); case 7: return $abbr ? JText::_('JULY_SHORT') : JText::_('JULY'); case 8: return $abbr ? JText::_('AUGUST_SHORT') : JText::_('AUGUST'); case 9: return $abbr ? JText::_('SEPTEMBER_SHORT') : JText::_('SEPTEMBER'); case 10: return $abbr ? JText::_('OCTOBER_SHORT') : JText::_('OCTOBER'); case 11: return $abbr ? JText::_('NOVEMBER_SHORT') : JText::_('NOVEMBER'); case 12: return $abbr ? JText::_('DECEMBER_SHORT') : JText::_('DECEMBER'); } }
function _yearToString($year, $abbr = false) { return $this->Convertnumber2thai($year+543,$abbr); } function _numToString($date, $abbr = false) { return $this->Convertnumber2thai($date,$abbr); }
////here convert to number in Thai function Convertnumber2thai($result,$abbr = false) { $thaiNumber = array ("à¹", "๑", "๒", "๓", "๔", "๕", "๖", "๗","๘", "๙" ); $org_result = $result; for ( $counter=0; $counter <= 9; $counter++) { $result = str_replace($counter, $thaiNumber[$counter], $result); } return $abbr ? $result : $org_result ; } /// end convert number 2 thai function _dayToString($day, $abbr = false) { switch ($day) { case 0: return $abbr ? JText::_('SUN') : JText::_('SUNDAY'); case 1: return $abbr ? JText::_('MON') : JText::_('MONDAY'); case 2: return $abbr ? JText::_('TUE') : JText::_('TUESDAY'); case 3: return $abbr ? JText::_('WED') : JText::_('WEDNESDAY'); case 4: return $abbr ? JText::_('THU') : JText::_('THURSDAY'); case 5: return $abbr ? JText::_('FRI') : JText::_('FRIDAY'); case 6: return $abbr ? JText::_('SAT') : JText::_('SATURDAY'); } } }
I used Joomla 1.5.11 and ccBoard Version: 1.1 RC Thanks for any advice in advance... |