Prevent error on invalid input date format

If $format_in is invalid, $date->format would throw a fatal PHP error. Thi patch fixes the problem.
Merge pull request #150 from kissifrot/master

Prevent error on invalid input date format