Source of file I18nDatetime.php
Size: 1,791 Bytes - Last Modified: 2021-12-24T05:19:36+00:00
/var/www/docs.ssmods.com/process/src/code/model/I18nDatetime.php
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 | <?php /** * formats dates using strftime * depends on PHPs setlocale() * * @package modules: i18n_fieldtypes * @author ivo.bathke */ class I18nDatetime extends SS_Datetime { protected static $format_nice = false; protected static $format_nicedate = false; protected static $format_nice24 = false; /** * Returns the datetime in the format given or from the lang file * locale sould be set */ public function Nice() { if ($this->value) { if (self::$format_nice !== false) { $format = self::$format_nice; } else { $format = _t('I18NDATETIME.DATETIMEFORMATNICE', '%m/%d/%G %I:%M%p'); } return $this->FormatI18N($format); } } public function NiceDate() { if ($this->value) { if (self::$format_nice !== false) { $format = self::$format_nicedate; } else { $format = _t('I18NDATETIME.DATEFORMATNICE', '%m/%d/%G'); } return $this->FormatI18N($format); } } public function Nice24() { if ($this->value) { if (self::$format_nice !== false) { $format = self::$format_nicedate24; } else { $format = _t('I18NDATETIME.DATETIMEFORMATNICE24', '%m/%d/%G'); } return date($format, strtotime($this->value)); } } public static function setFormatNice($format) { self::$format_nice = $format; } public static function setFormatNicedate($format) { self::$format_nicedate = $format; } public static function setFormatNice24($format) { self::$format_nice24 = $format; } } |