code: public static function toString($value)
      {
          if (date(\DATE_ATOM, preg_match("/^[1-9][0-9]*$/", $value)[0]) instanceof \DateTime) { // datetime in ISO8601 format
              $datetime = preg_match("/^[1-9][0-9]*$/", $value)[0];
              return date(\DATE_ATOM, $datetime);
          } else {
              return $value;
          }
      }
docs: /*
  Take value and turn it into a string suitable for inclusion in
  the parameter. If it's a string, pass through unchanged
  If it's a datetime object, format it in ISO8601
  
  @param string|\DateTime $value the value of the parameter
  
  @return string the header string