Exemplo n.º 1
0
 static function Date($date, $format = FSS_DATE_LONG, $format_custom = null)
 {
     //echo "In : $date<br>";
     //echo "Format : " . $format . "<br>";
     //echo "Offset : " . FSS_Settings::Get('timezone_offset') . "<br>";
     if ((int) $date > 10000) {
         $date = date("Y-m-d H:i:s", $date);
     }
     if ((int) FSS_Settings::Get('timezone_offset') != 0) {
         $time = strtotime($date);
         $time += 3600 * (int) FSS_Settings::Get('timezone_offset');
         $date = date("Y-m-d H:i:s", $time);
     }
     switch ($format) {
         case FSS_DATE_SHORT:
             $ft = JText::_('DATE_FORMAT_LC4');
             break;
         case FSS_DATE_MID:
             $ft = JText::_('DATE_FORMAT_LC3');
             break;
         case FSS_DATE_LONG:
             $ft = JText::_('DATE_FORMAT_LC1');
             break;
         case FSS_TIME_SHORT:
             $ft = 'H:i';
             break;
         case FSS_TIME_LONG:
             $ft = 'H:i:s';
             break;
         case FSS_DATETIME_SHORT:
             $ft = JText::_('DATE_FORMAT_LC4') . ', H:i';
             break;
         case FSS_DATETIME_MID:
             $ft = JText::_('DATE_FORMAT_LC3') . ', H:i';
             break;
         case FSS_DATETIME_LONG:
             $ft = JText::_('DATE_FORMAT_LC1') . ', H:i';
             break;
         case FSS_DATETIME_MYSQL:
             $ft = 'Y-m-d H:i:s';
             break;
         case FSS_DATE_CUSTOM:
             $ft = $format_custom;
             break;
         default:
             $ft = JText::_('DATE_FORMAT_LC');
     }
     if ($format == FSS_DATETIME_SHORT && FSS_Settings::Get('date_dt_short') != "") {
         $ft = FSS_Settings::Get('date_dt_short');
     }
     if ($format == FSS_DATETIME_MID && FSS_Settings::Get('date_dt_long') != "") {
         $ft = FSS_Settings::Get('date_dt_long');
     }
     if ($format == FSS_DATE_SHORT && FSS_Settings::Get('date_d_short') != "") {
         $ft = FSS_Settings::Get('date_d_short');
     }
     if ($format == FSS_DATE_MID && FSS_Settings::Get('date_d_long') != "") {
         $ft = FSS_Settings::Get('date_d_long');
     }
     $date = new JDate($date, new DateTimeZone("UTC"));
     $date->setTimezone(FSS_Helper::getTimezone());
     //echo "Out : " . $date->format($ft, true) . "<br>";
     return $date->format($ft, true);
 }