SERVER SIDE DATE TIME AND CLIENT SIDE DATE TIME INFO
<%@ Page Language="VB"
AutoEventWireup="false"
CodeFile="Default.aspx.vb"
Inherits="_Default"
%>
<!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 id="Head1"
runat="server">
<title>Untitled
Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<h1>server side
date time info</h1>
<% Dim dt As Date
dt = Now()
Response.Write("current
date is")
Response.Write(dt.Day)
Response.Write("/")
Response.Write(dt.Month)
Response.Write("/")
Response.Write(dt.Year)
Response.Write("<br>")
Response.Write("current
time is")
Response.Write(dt.Hour)
Response.Write(":")
Response.Write(dt.Minute)
Response.Write(":")
Response.Write(dt.Second)
Response.Write("<br>")
Response.Write("month
name is")
Response.Write(MonthName(Month(dt)))
Response.Write("<br>")
Response.Write("weekday
name is")
Response.Write(WeekdayName(Weekday(dt)))
Response.Write("<br>")
%>
<h1>client side
date time info</h1>
<script language="javascript"
type="text/javascript">
var cdt
cdt=new
Date()
document.write("current
date is")
document.write(cdt.getDate())
document.write("/")
document.write(cdt.getMonth()+1)
document.write("/")
document.write(cdt.getFullYear())
document.write("<br>")
document.write("current
time is")
document.write(cdt.getHours())
document.write(":")
document.write(cdt.getMinutes())
document.write(":")
document.write(cdt.getSeconds())
document.write("<br>")
var dy=new Array(7)
dy[0]="sunday"
dy[1]="monday"
dy[2]="tuesday"
dy[3]="wednesday"
dy[4]="thursday"
dy[5]="friday"
dy[6]="saturday"
var
wk=dy[cdt.getDay()];
document.write("weekday NAME IS
" +wk);
document.write("<br>")
var month
= new Array();
month[0] = "January";
month[1] = "February";
month[2] = "March";
month[3] = "April";
month[4] = "May";
month[5] = "June";
month[6] = "July";
month[7] = "August";
month[8] = "September";
month[9] = "October";
month[10] = "November";
month[11] = "December";
var mn =
month[cdt.getMonth()];
document.write("month NAME
IS " +mn)
</script>
</div>
</form>
</body>
</html>
No comments:
Post a Comment