﻿{
  var today = new Date();
	var h = today.getHours();
	var m = today.getMinutes();
	var s = today.getSeconds();
	h = convertFromMil(h);
	m=checkTime(m)
  s=checkTime(s)
	document.write (h + ":" + m + ":" + s);
}

function convertFromMil(h)
{
  if(h > 12)
	{
	  h = h - 12;
	}
  return h;
}

function checkTime(ms)
{
  if (ms < 10) 
  {
	  ms = "0" + ms;
	}
  return ms;
}