function getTime(JSONData) { if (JSONData != null) { alert(TimeStampToDate(JSONData.Result.Timestamp)); } } function TimeStampToDate(xmlDate) { return new Date(xmlDate); } function dynamicTag() { request = "http://developer.yahooapis.com/TimeService/V1/getTime?appid=YahooDemo&output=json&callback=getTime&format=ms"; var head = document.getElementsByTagName("head").item(0); var script = document.createElement("script"); script.setAttribute("type", "text/javascript"); script.setAttribute("src", request); head.appendChild(script); }