示例#1
0
 static function ConformDateFormat($AccessDateTime, $params, $format_option, $default_date = "1999-11-30 10:00:00")
 {
     switch ($format_option) {
         /*
          * Date / Time when item was played at last ***********************************************************************************************************************************************************************
          */
         case "access":
             if ($AccessDateTime == '0000-00-00 00:00:00' || $AccessDateTime == '') {
                 //check if create value exists
                 return $default_date;
             } else {
                 $Accesstrack_value = $AccessDateTime;
                 return JHTML::_('date', $Accesstrack_value, JText::_($params->get('date_format')));
             }
             break;
         case "access_value":
             if ($AccessDateTime == '0000-00-00 00:00:00' || $AccessDateTime == '') {
                 //check if create value exists
                 return $default_date;
             } else {
                 $Accesstrack_stamp = strtotime($AccessDateTime) + modLastPlayedHelper::TimezoneSetting() - modLastPlayedHelper::TimezoneServer();
                 $Accesstrack_value = date("Y-m-d H:i:s", $Accesstrack_stamp);
             }
             return $Accesstrack_value;
             break;
         default:
             return JText::_('TCE_PLG_ERROR_NO_FORMAT_OPTION');
     }
 }