Fix formatDate: show the last index of separators

if there are some other string at the end of the format, like "yyyy-mm-dd hh:00" (the string ":00"), it will be shown as "2013-05-23 13", but it should be "2013-05-23 13:00"