Monday, December 22, 2008

Show Formatted Date And Time Using Java Script...

Today , I m here to give an example how to get the formated Date And Time using Java Script, and the Format is Like "Mon Dec 22 2008 10:52:07 PM" . so have a look on the following example...

function ShowFormattedDateAndTime()
var now = new Date() ;
var time=now.toLocaleTimeString();
var dayname=now.toDateString();
var totaldaytime=dayname+" "+time;
document.getElementById("Lbl").innerHTML="Draft Auto Saved at " + totaldaytime;

Sanjeev Kumar
HelpOn Desk Team

No comments: