How to include the Date in my website

Website design and development, management of forums, blogs, wikis, and all sorts of websites.

15 people like this topic, 17 people dislike this topic

NadineCrotty55

How to include the Date in my website

Postby NadineCrotty55 » Tue Jun 30, 2015 12:16 pm



My code in above post , displays the date in digits only, if you want the name of month, day etc to appear, use this code >



<script language="JavaScript">
<!--
var now = new Date();
var days = new Array(
'Sunday','Monday','Tuesday',
'Wednesday','Thursday','Friday','Saturday');
var months = new Array(
'January','February','March','April','May',
'June','July','August','September','October',
'November','December');
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
function fourdigits(number) {
return (number < 1000) ? number + 1900 : number;}
today = days + ", " +
months + " " +
date + ", " +
(fourdigits(now.getYear()));
document.write(today);
//-->
</script>



Code (markup):


Hope this helps :)

 


 


Return to “Webmaster”

Who is online

Users browsing this forum: No registered users and 2 guests

cron