Time Difference for Page Creation time

U

Usman Ghani

Hi There,
I want to display below page creation time and so I have two variables
as:
Dim start_time As New DateTime
Dim end_time As New DateTime
First I am storing value in start_time on page pre_render as
Private Sub Page_PreRender(ByVal sender As Object, ByVal e As
System.EventArgs) Handles MyBase.PreRender
start_time = Now
End Sub

And then storing value in end_time on page load event as
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
'Put user code to initialize the page here
If Not IsPostBack Then
end_time = Now
End If
** here I want to display the time difference, will it be like
lblPageCreationTime.Text = start_time - end_time , this one is giving
error here?
End Sub
Can someone please help me here?

Best Regards,

Usman
 
J

Josh Moody [MSFT]

What you want to do is

lblPageCreationTime.Text = end_time.Subtract(start_time).ToString

Josh Moody
VSU Team

--

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm

Note: For the benefit of the community-at-large, all responses to this
message are best directed to the newsgroup/thread from which they
originated.
--------------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top