How To Get Client Side Date & Time?

By Goniey N (Mr. G)

Using JavaScript Function You Can Get Day-Month-Year-Hours-Minutes & Seconds.... Source Code File Is Also Available....


<Script type="text/javascript">
     function DisplayDateTime()
     {
     var DateTime = new Date();
     var strYear= DateTime.getYear();
     var strMonth= DateTime.getMonth() +1;
     var strDay = DateTime.getDate();
     var strHours = DateTime.getHours();
     var strMinutes = DateTime.getMinutes();
     var strSeconds = DateTime.getSeconds();
     var tagDiv=document.getElementById("DivTag");
     tagDiv.innerText = strDay + "/" + strMonth + "/" + strYear + " " + strHours + ":" + strMinutes + ":" + strSeconds;
     }
</Script>

<
Body bgcolor=#00ff00 onload="DisplayDateTime();">
     <H3>
          DD/MM/YYYY HH:MM:SS
     </H3>
     <H1>
          <Div id="DivTag"></div>
     </H1>
</Body>



See Below Image :






You Can Download Source File, For That : Click Here

How To Get Client Side Date & Time?  (3307 Views)