javascript - about 24 hours and 12 hours -


this question has answer here:

i want change hours 12hrs not 24hrs.

this code :

$(document).ready(function() {     var monthnames = ["january", "february", "march", "april", "may", "june", "july", "august", "september", "october", "november", "december"];     var daynames = ["sunday", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday"];     var newdate = new date();     newdate.setdate(newdate.getdate());     $('#date').html(daynames[newdate.getday()] + " " + newdate.getdate() + ' ' + monthnames[newdate.getmonth()] + ' ' + newdate.getfullyear());     setinterval(function() {         var seconds = new date().getseconds();         $("#sec").html((seconds < 10 ? "0" : "") + seconds);     }, 1000);     setinterval(function() {         var minutes = new date().getminutes();         $("#min").html((minutes < 10 ? "0" : "") + minutes);     }, 1000);     setinterval(function() {         var hours = new date().gethours();         $("#hours").html((hours < 10 ? "0" : "") + hours);     }, 1000); }); 

you looking this

newhours = (oldhours) % 12 if (newhours == 0) {     newhours = 12; } 

Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -