Web Designer? Design and market your own professional website with easy-to-use tools.
cDate = new Date();
document.write("The date and time is: " + cDate.toLocaleString());
Now enter the code above into your (X)HTML file and name it "jspractice.html".
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Now view your jspractice.html page. It should display the current date and local time.