dotnetspider.com
Login Login    Register      

TutorialsForumCareer DevelopmentResourcesReviewsJobsInterviewCommunitiesProjectsTraining

Subscribe to Subscribers
Talk to Webmaster
Tony John

Facebook
Google+
Twitter
LinkedIn
Online MembersDevaraj T N
Phagu Mahato
Priya jain
srirama
More...
Join our online Google+ community for Bloggers, Content Writers and Webmasters




Resources » Code Snippets » Html

Display Dynamic Date


Posted Date:     Category: Html    
Author: Member Level: Silver    Points: 5


display a Dynamic Date in html page that automatically update



 


Display Dynamic Date



Hi Friends,

some times we are working with HTML pages , here i give a example to show dynamic date on HTML Page



Followed this code inside html page





<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Show Date </title>
</head>

<body onLoad="goforit()">
<script>
var dayarray=new Array("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday")
var montharray=new Array("January","February","March","April","May","June","July","August","September","October","November","December")

function getthedate(){
var mydate=new Date()
var year=mydate.getYear()
if (year < 1000)
year+=1900
var day=mydate.getDay()
var month=mydate.getMonth()
var daym=mydate.getDate()
if (daym <10)
daym="0"+daym

//change font size here
var cdate=" <small> <font color='000000' face='Arial'> <b>"+dayarray[day]+", "+montharray[month]+" "+daym+", "+year
+" </b> </font> </small>"
if (document.all)
document.all.clock.innerHTML=cdate
else if (document.getElementById)
document.getElementById("clock").innerHTML=cdate
else
document.write(cdate)
}
if (!document.all&&!document.getElementById)
getthedate()
function goforit(){
if (document.all||document.getElementById)
setInterval("getthedate()",1000)
}

</script>
<span id="clock"> </span>
</body>
</html>

Attachments
  • Display Dynamic Date (38566-2622-date.html)
  • Related Resources:


    Read related articles: Javascript display date    Display Dynamic Date    Javascript function    


    Did you like this resource? Share it with your friends and show your love!


    Responses to "Display Dynamic Date"

    No responses found. Be the first to respond...

    Feedbacks      

    Post Comment:




  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:   Sign In to fill automatically.
    Email: (Will not be published, but required to validate comment)



    Type the numbers and letters shown on the left.


    Next Resource: Add Google map on your page
    Previous Resource: Dynamically Add,Delete,Edit and Update values in Table
    Return to Resources
    Post New Resource
    Category: Html


    Post resources and earn money!
     
    More Resources
    Popular Tags   Tag posting guidelines   Search Tags  
    Display Dynamic Date  .  



    Follow us on Twitter: https://twitter.com/dotnetspider

    Active Members
    TodayLast 7 Daysmore...

    Awards & Gifts
    Email subscription
  • .NET Jobs
  • .NET Articles
  • .NET Forums
  • Articles Rss Feeds
    Forum Rss Feeds


    About Us    Contact Us    Copyright    Privacy Policy    Terms Of Use    Revenue Sharing sites   Advertise   Talk to Tony John
    Copyright © SpiderWorks Technologies Pvt Ltd., Kochi, India
    2005 - 2012 All Rights Reserved.
    .NET and other trademarks mentioned in this site belong to Microsoft and other respective trademark owners.
    Articles, tutorials and all other content offered here is for educational purpose only.
    We are not associated with Microsoft or its partners.