Displaying the time in 12hr format
I need your help.
If the code below is able to get the date in my requested format of:
dd/mm/yyyy
How do I go about getting the time in a 12hr format ie. 13:53 is 1:53pm
Thank you
<script type="text/javascript">
function test() {
var d = new Date(),
m = d.getMonth()+1,
xdate = [d.getDate(), (m < 10) ? '0' + m : m, d.getFullYear()].join('/');
var t = d.format("h:mm ss");
alert("the date is:"+ xdate +"time is:" + t)
}
</script>
No comments:
Post a Comment