code: public static function stringToExcel($dateValue)
      {
          if (strlen($dateValue) < 2) {
              return false;
          }
          if (!preg_match('/^(\d{1,4}[ \.\/\-][A-Z]{3,9}([ \.\/\-]\d{1,4})?|[A-Z]{3,9}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?|\d{1,4}[ \.\/\-]\d{1,4}([ \.\/\-]\d{1,4})?)( \d{1,2}:\d{1,2}(:\d{1,2})?)?$/iu', $dateValue)) {
              return false;
          }
  
          $dateValueNew = DateTime::DATEVALUE($dateValue);
  
          if ($dateValueNew === Functions::VALUE()) {
              return false;
          }
  
          if (strpos($dateValue, ':') !== false) {
              $timeValue = DateTime::TIMEVALUE($dateValue);
              if ($timeValue === Functions::VALUE()) {
                  return false;
              }
              $dateValueNew += $timeValue;
          }
  
          return $dateValueNew;
      }
docs: Convert a date/time string to Excel time.
  
  @param string $dateValue Examples: '2009-12-31', '2009-12-31 15:59', '2009-12-31 15:59:10'
  
  @return false|float Excel date/time serial value