var now = new Date();
var hh = now.getHours();
var min = now.getMinutes();
				
var ampm = (hh>=12)?'pm':'am';
hh = hh%12;
hh = hh?hh:12;
hh = hh<10?'0'+hh:hh;
min = min<10?'0'+min:min;
				
var time = hh+" : "+min+" "+ampm;
alert(time);
1
Contributor
0
Replies
18
Views
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.