diff --git a/src/MD_STD.php b/src/MD_STD.php index 5aeb40f..67edd58 100644 --- a/src/MD_STD.php +++ b/src/MD_STD.php @@ -303,6 +303,27 @@ final class MD_STD { } + /** + * Wrapper around self::strtotime() that will return MDParseException (an expected + * exception) rather than MDInvalidInputDate (an unexpected exception). + * + * @param string $datetime String to convert. + * + * @return integer + */ + public static function strtotime_for_public_apis(string $datetime):int { + + try { + $output = self::strtotime($datetime); + } + catch (MDInvalidInputDate $e) { + throw new MDParseException($e->getMessage()); + } + + return $output; + + } + /** * Initializes a curl request with the given presets. *