functionformatAMPM(date){varhours=date.getHours();varminutes=date.getMinutes();varampm=hours>=12?'pm':'am';hours=hours%12;hours=hours?hours:12;// the hour '0' should be '12'minutes=minutes<10?'0'+minutes:minutes;varstrTime=hours+':'+minutes+' '+ampm;returnstrTime;}
Comments (0)
HTTPSSSH
You can clone a snippet to your computer for local editing.
Learn more.