I'm not sure what you're parsing. Date doesn't use %'s within its format and shows literally, while strftime doesn't use g:i:a to indicate its hour minute and am/pm representative. That would be %I:%M:%P.
There is no way to add the . between the a and m. That requires manual insertion instead:
if (strftime('%p', $iTime) == 'AM')
$sTime = strftime('%I:%M a.m', $iTime);
$sTime = strftime('%I:%M p.m', $iTime);