Helper::convertMySQL2HTML PHP Method

convertMySQL2HTML() public static method

public static convertMySQL2HTML ( $value, $empty_string = '-' )
    public static function convertMySQL2HTML($value, $empty_string = '-')
    {
        if (preg_match('/^\\d{4}-\\d{2}-\\d{2}/', $value) && $value != '0000-00-00 00:00:00' && $value != '0000-00-00') {
            return self::convertDate2HTML($value, $empty_string);
        } else {
            return $empty_string;
        }
    }

Usage Example

 /**
  * @param $attribute
  * @param string $empty_string
  * @return string
  */
 public function NHSDateAsHTML($attribute, $empty_string = '-')
 {
     if ($value = $this->getAttribute($attribute)) {
         return Helper::convertMySQL2HTML($value, $empty_string);
     }
 }