code: public static function TEXTFORMAT($value, $format)
      {
          $value = Functions::flattenSingleValue($value);
          $format = Functions::flattenSingleValue($format);
  
          if ((is_string($value)) && (!is_numeric($value)) && Date::isDateTimeFormatCode($format)) {
              $value = DateTime::DATEVALUE($value);
          }
  
          return (string) NumberFormat::toFormattedString($value, $format);
      }
docs: TEXTFORMAT.
  
  @param mixed $value Value to check
  @param string $format Format mask to use
  
  @return string