Is there a way to have javascript convert iso8601 time into 12 hour readable time format? Also, could it read –:–:– that iso8601 uses for no time, and not print anything when it finds this?
Please help!!
<script type="text/javascript"> var iso='2007-10-16 16:00:00'; var time=iso.split(' '); if(time.length<2) { alert(time[0]+' --:--:--'); } else { var units=time[1].split(':'); units[0]=(units[0]>12)? (units[0]-12)+'pm' : units[0]+'am'; alert(time[0]+' '+units[0]+' '+units[1]+':'+units[2]) } </script>
Help @nnhubbard spread the word by sharing this article on Twitter...