我有以下代码从 json API 获取当前 uct 时间和时间,并在代码的注释部分查看它显示的输出。我想以以下形式显示两个时间(DD/MM/YYYY HH:MM AM/PM ) 例如 15/08/2013 10.43 AM。请让我知道要使用哪个插件以及需要更改代码。
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.js" type="text/javascript"></script>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script>
<script src="Scripts/json2.js" type="text/javascript"></script>
<script src="Scripts/json.js" type="text/javascript"></script>
<script type="text/javascript" language="javascript">
$(document).ready(function () {
//current UTC Time displays output as 15/8/2013 10:43:51 not showing AM or PM
var currentutctime = new Date();
var formatdate = currentutctime.getUTCDate() + '/' + (currentutctime.getUTCMonth() + 1) + '/' + currentutctime.getUTCFullYear() + ' ' + currentutctime.getUTCHours() + ':' + currentutctime.getUTCMinutes() + ':' + currentutctime.getUTCSeconds();
$('#lblutctime').text(formatdate)
//JSON API Time displays output as August 15,2013 10:42:59 GMT+0100 , not showing AM or PM
$.ajax({
url: 'http://timeapi.org/utc/now.json',
dataType: 'jsonp'
})
.done(function (response) {
$('#lblntp').text(response.dateString);
})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="lblutctime" runat="server" Text="Label"></asp:Label>
<asp:Label ID="lblntp" runat="server" Text="Label"></asp:Label>
</div>
</form>
</body>
</html>