related sites: <FREE Help> <ASP> <Asp.net> <worldwide> feedback: <lovethat> <hatethat> <thanks> <credits> <contact us>
ASPTime VB Component by Sonny Yu sonny@granitetv.com with help from Juan Llibre j.llibre@codetel.net.do
This is a very simple component written in Visual Basic. You can create it by making a new "Active-X DLL" project
Here is the Visual Basic source code for the component: Private Type systemtime wYear As Integer wMonth As Integer wDayOfWeek As Integer wDay As Integer wHour As Integer wMinute As Integer wSecond As Integer wMilliseconds As Integer End Type Private Declare Sub GetSystemTime Lib "kernel32" (lpSystemTime As systemtime) 'local variable(s) to hold property value(s) Private mvarutcyear As String Private mvarutcmonth As String Private mvarutcday As String Private mvarutcdayweek As String Private mvarutchour As String Private mvarutcmin As String Private mvarutcsecond As String ' Private mvarutcmillisecond As String Public Property Get utcmillisecond() As String utcmillisecond = mvarutcmillisecond End Property Public Property Get utcsecond() As String utcsecond = mvarutcsecond End Property Public Property Get utcmin() As String utcmin = mvarutcmin End Property Public Property Get utchour() As String utchour = mvarutchour End Property Public Property Get utcdayweek() As String utcdayweek = mvarutcdayweek End Property Public Property Get utcday() As String utcday = mvarutcday End Property Public Property Get utcmonth() As String utcmonth = mvarutcmonth End Property Public Property Get utcyear() As String 'used when retrieving value of a property, on the right side of an assignment. utcyear = mvarutcyear End Property Public Sub systemtime() Dim Asptime As systemtime Call GetSystemTime(Asptime) mvarutcmillisecond = CStr(Asptime.wMilliseconds) mvarutcsecond = CStr(Asptime.wSecond) mvarutcmin = CStr(Asptime.wMinute) mvarutchour = CStr(Asptime.wHour) mvarutcdayweek = CStr(Asptime.wDayOfWeek) mvarutcday = CStr(Asptime.wDay) mvarutcmonth = CStr(Asptime.wMonth) mvarutcyear = CStr(Asptime.wYear) End Sub
Now it is invoked on an ASP page with the following code: <Test Script Below>
<HTML><HEAD> <TITLE>asptime.asp by Sunny Yu, Juan Llibre</TITLE> </HEAD><body bgcolor="#FFFFFF"> <% <% dim obtime set obtime=server.createobject("Asptime.AsptimeClass") obtime.systemtime response.write "Year " & obtime.utcyear & " , " response.write "Month " & obtime.utcmonth & " , " response.write "Day " & obtime.utcday & " , " response.write "Hour " & obtime.utchour & " , " response.write "Minute " & obtime.utcmin & " , " response.write "Second " & obtime.utcsecond & " , " response.write "millisecond " & obtime.utcmillisecond dim cn(100) dim cmd(100) For x = 0 to 100 Set cn(x) = Server.CreateObject("ADODB.Connection") cn(x).Open "DSN=student;uid=student;pwd=magic" Set cmd(x) = Server.CreateObject("ADODB.Command") cmd(x).activeconnection = cn(x) cmd(x).commandtext = "SELECT * FROM Authors" cmd(x).execute Set cmd(x) = Nothing cn(x).close Next set obtime2=server.createobject("Asptime.AsptimeClass") obtime2.systemtime response.write "<br>Second " & obtime2.utcsecond & " , " & "millisecond " & obtime2.utcmillisecond & "<br>" x=((obtime.utcsecond)*1000)+obtime.utcmillisecond y=((obtime2.utcsecond)*1000)+obtime2.utcmillisecond response.write y-x set obtime=nothing set obtime2=nothing %> %> </BODY></HTML>