public static function getInputFormat($strFormat = null)
{
if ($strFormat === null) {
$strFormat = static::getNumericDateFormat();
}
if (!static::isNumericFormat($strFormat)) {
throw new \Exception(sprintf('Invalid date format "%s"', $strFormat));
}
$arrCharacterMapper = array('a' => 'am', 'A' => 'AM', 'd' => 'DD', 'j' => 'D', 'm' => 'MM', 'n' => 'M', 'y' => 'YY', 'Y' => 'YYYY', 'h' => 'hh', 'H' => 'hh', 'g' => 'h', 'G' => 'h', 'i' => 'mm', 's' => 'ss');
$arrInputFormat = array();
$arrCharacters = str_split($strFormat);
foreach ($arrCharacters as $strCharacter) {
if (isset($arrCharacterMapper[$strCharacter])) {
$arrInputFormat[$strFormat] .= $arrCharacterMapper[$strCharacter];
} else {
$arrInputFormat[$strFormat] .= $strCharacter;
}
}
return $arrInputFormat[$strFormat];
}