I am trying to use JavaScript to display the date and time on my webapp.
Although I have had success doing this my date and time is printed as 29/5/13. I want it to have a zero in front of the month if it is less than ten. I have tried using an if statement but didnt have much sucess. My code that I currently have is:
<script language="javascript">
today = new Date();
document.write("<BR>Time: ", today.getHours(),":",today.getMinutes());
document.write("<BR>Date: ", today.getDate(),"/",today.getMonth()+1,"/",today.getYear()-100);
</script>
Any help would be greatly appreciated.