Comment on Tutorial - JSP Program for display Date By aathishankaran



Comment Added by : pmprash

Comment Added at : 2009-12-22 01:15:33

Comment on Tutorial : JSP Program for display Date By aathishankaran
Use (JavaScript) below code to display client date and time on web page


<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content=\"text/html; charset=iso-8859-1\">
<STYLE type=text/css>.mainheading {     FONT-WEIGHT: bold; FONT-SIZE: 14px; COLOR: #000000; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif }.mainbody {     FONT-SIZE: x-small; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif; LIST-STYLE-TYPE: square}.maintitle { FONT-WEIGHT: bold; FONT-SIZE: medium; FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif}</STYLE>
</HEAD>
<BODY text=#000000 bgColor=#ffffff leftMargin=1 topMargin=0 onload=\"setFromTo();\">
<TABLE cellSpacing=3 cellPadding=0 width=770 border=0>
 <TBODY>
 <TR>
   <TD width=77>&nbsp;</TD>
   <TD class=mainheading>
     <P>&nbsp;</P>

   </TD>
 </TR>
 <TR>
   <TD colSpan=2>
     <HR color=green>
   </TD>
 </TR>
 <TR>
   <TD width=77>&nbsp;</TD>
   <TD><P></P>
<P>Today\'s Date & Time on Client machine </P>
<SCRIPT LANGUAGE=\"JavaScript\">
<!--
tday  =new Array(\"Sun\",\"Mon\",\"Tue\", \"Wed\",\"Thu\",\"Fri\",\"Sat\ ");
tmonth=new Array(\"January\",\"February\" ,\"March\",\"April\",\"May\",\ "June\",\"July\",\"August\",\" September\",\"October\",\" November\",\"December\");
function GetClock(){
d = new Date();
nday   = d.getDay();
nmonth = d.getMonth();
ndate  = d.getDate();
nyeara = d.getYear();
nhour  = d.getHours();
nmin   = d.getMinutes();
nsec   = d.getSeconds();
if(nyeara<1000){nyeara=(\"\"+( nyeara+11900)).substring(1,5); }
else{nyeara=(\"\"+(nyeara+ 10000)).substring(1,5);}
    if(nhour ==  0) {ap = \" AM\";nhour = 12;}
else if(nhour <= 11) {ap = \" AM\";}
else if(nhour == 12) {ap = \" PM\";}
else if(nhour >= 13) {ap = \" PM\";nhour -= 12;}
if(nmin <= 9) {nmin = \"0\" +nmin;}
if(nsec <= 9) {nsec = \"0\" +nsec;}
document.getElementById(\' clockbox\').innerHTML=\"\"+ tday[nday]+\", \"+tmonth[nmonth]+\" \"+ndate+\", \"+nyeara+\" \"+nhour+\":\"+nmin+\":\"+ nsec+ap+\"\";
setTimeout(\"GetClock()\", 1000);
}
window.onload=function(){ GetClock();}
//--></script>
<div id=\"clockbox\"></div>
<P></P>
<P> Admin</P>
  <P class=mainbody>&nbsp;</P>
   </TD>
 </TR>
 <TR>
   <TD width=77>&nbsp;</TD>
   <TD class=mainbody></TD>

 </TR>
 <TR>
   <TD colSpan=2>
     <HR color=green>
   </TD>
 </TR>
 </TBODY>
</TABLE>
</BODY>
</HTML>


View Tutorial



Subscribe to Tutorials

Related Tutorials

Update contents of a file within a jar file

Tomcat and httpd configured in port 8080 and 80

Java File

Java String

Count number of vowels, consonants and digits in a String in Java

Reverse a number in Java

Student marks calculation program in Java

Handling Fractions in Java

Calculate gross salary in Java

Calculate average sale of the week in Java

Vector in Java - Sample Program

MultiLevel Inheritance sample in Java

Multiple Inheritance sample in Java

Java program using Method Overriding

Java program to check if user input is an even number

Archived Comments

1. Isn't the Vector class deprecated now? I think Arr
View Tutorial          By: Brent at 2013-07-07 06:10:01

2. nice one
View Tutorial          By: dhusor at 2012-05-08 17:38:50

3. Excellent example! Thanks a ton:-)
One ques

View Tutorial          By: Andrew at 2009-04-11 09:15:19

4. setListAdapter(new ArrayAdapter<String>(

View Tutorial          By: Mark at 2013-02-02 02:25:42

5. can anyone tell me which type of device i need to
View Tutorial          By: dhanunjay at 2009-04-01 00:31:17

6. Hi Maybelline, This is the <a href="http:/
View Tutorial          By: Daniel Malcolm at 2008-08-21 06:57:31

7. In my Midlet class there is a constructor which i
View Tutorial          By: nicolas at 2011-11-12 21:35:58

8. import java.io.*;
import java.util.Stack;
View Tutorial          By: jack&jill at 2011-07-26 06:40:32

9. good
View Tutorial          By: gummalla subbarao at 2011-03-09 01:24:58

10. hello
plz tell me what can i do for sending

View Tutorial          By: mahipal at 2009-05-12 10:30:57