function validSamlDateFormat($samlDate) 
   {
      if ($samlDate == "") return false;
      $indexT = strpos($samlDate, 'T');
      $indexZ = strpos($samlDate, 'Z');
      if (($indexT != 10) || ($indexZ != 19)) {
         return false;
      }
      $dateString = substr($samlDate, 0, 10);
      $timeString = substr($samlDate, $indexT + 1, 8);
      list($year, $month, $day) = explode('-', $dateString);
      list($hour, $minute, $second) = explode(':', $timeString);
      $parsedDate = gmmktime($hour, $minute, $second, $month, $day, $year);
      if (($parsedDate === false) || ($parsedDate == -1)) return false;
      if (!checkdate($month, $day, $year)) return false;
      return $parsedDate;
   }