I m trying to implement a method which can understand which coutry you are living and show time time exactly for this country. for example if you are living in USA showing the time with am/pm but if you are living in the Turkey showing the time for 24 hour format. I found a way to conver 24 hour system to am/pm but after that i got clueless.. Any ideas how to achieve that ?
function formatAMPM(date) {
var hours = date.getHours();
var minutes = date.getMinutes();
var ampm = hours >= 12 ? 'pm' : 'am';
hours = hours % 12;
hours = hours ? hours : 12; // the hour '0' should be '12'
minutes = minutes < 10 ? '0'+minutes : minutes;
var strTime = hours + ':' + minutes + ' ' + ampm;
return strTime;
}