Wrox Home  
Search P2P Archive for: Go

  Return to Index  

aspx thread: Date and Time


Message #1 by "jmlatham" <Marshall@n...> on Fri, 19 Apr 2002 21:54:15
In ASP I code use functions like time(), date(), and now() to get and 
display the current date/time.  Is there an equivalent in C# embedded in 
an aspx to get that information?  Is there a special namespace that I need 
to use to get the current date/time?
Message #2 by "Minh T. Nguyen" <nguyentriminh@y...> on Fri, 19 Apr 2002 14:11:01 -0700
There's actually a much much better way to time your functions. ASP.NET
has that built in:

Edit your Web.config file and turn on tracing:

<configuration>
 <system.web>
  <trace enabled="true" requestLimit="10" ...>
   ...

Then, open up two browsers. In one browser you can just surf your your
web application. Let's say your web application is at
http://localhost/MyWebApplication. Then, in the other browser, just go
to http://localhost/MyWebApplication/trace.axd

and you will see a list of the last ten requests. Then, you can click on
"View Details" on your request and you have a complete dump of all kind
information: trace, session state, application state, cookies, server
variables and so on.

Now, in your ASP codebehind code do the following:

Trace.Write("MyMethod is starting here...");
MyMethod(...);
Trace.Write("MyMethod ends here...");

and then you will the exact time it takes to execute your MyMethod. It's
really impressive what Microsoft have done there.

Have fun,
Minh.



-----Original Message-----
From: jmlatham [mailto:Marshall@n...] 
Sent: Friday, April 19, 2002 9:54 PM
To: ASP+
Subject: [aspx] Date and Time


In ASP I code use functions like time(), date(), and now() to get and 
display the current date/time.  Is there an equivalent in C# embedded in

an aspx to get that information?  Is there a special namespace that I
need 
to use to get the current date/time?

Message #3 by "John Balkus" <aim@l...> on Fri, 19 Apr 2002 23:21:52 -0700
Use the DateTime object example DateTime.Now

-----Original Message-----
From: Minh T. Nguyen [mailto:nguyentriminh@y...] 
Sent: Friday, April 19, 2002 2:11 PM
To: ASP+
Subject: [aspx] RE: Date and Time

There's actually a much much better way to time your functions. ASP.NET
has that built in:

Edit your Web.config file and turn on tracing:

<configuration>
 <system.web>
  <trace enabled="true" requestLimit="10" ...>
   ...

Then, open up two browsers. In one browser you can just surf your your
web application. Let's say your web application is at
http://localhost/MyWebApplication. Then, in the other browser, just go
to http://localhost/MyWebApplication/trace.axd

and you will see a list of the last ten requests. Then, you can click on
"View Details" on your request and you have a complete dump of all kind
information: trace, session state, application state, cookies, server
variables and so on.

Now, in your ASP codebehind code do the following:

Trace.Write("MyMethod is starting here...");
MyMethod(...);
Trace.Write("MyMethod ends here...");

and then you will the exact time it takes to execute your MyMethod. It's
really impressive what Microsoft have done there.

Have fun,
Minh.



-----Original Message-----
From: jmlatham [mailto:Marshall@n...] 
Sent: Friday, April 19, 2002 9:54 PM
To: ASP+
Subject: [aspx] Date and Time


In ASP I code use functions like time(), date(), and now() to get and 
display the current date/time.  Is there an equivalent in C# embedded in

an aspx to get that information?  Is there a special namespace that I
need 
to use to get the current date/time?



Message #4 by "Minh T. Nguyen" <nguyentriminh@y...> on Fri, 19 Apr 2002 23:39:17 -0700
jmlatham,

	Sorry for my previous long post, but apparently I read your
question wrong. :) You just wanted to know a function to get the time,
and for some strange reasons, I've read that you wanted to time your
function. So, yeah, please ignore my previous long post. :)

Minh.

-----Original Message-----
From: jmlatham [mailto:Marshall@n...] 
Sent: Friday, April 19, 2002 9:54 PM
To: ASP+
Subject: [aspx] Date and Time


In ASP I code use functions like time(), date(), and now() to get and 
display the current date/time.  Is there an equivalent in C# embedded in

an aspx to get that information?  Is there a special namespace that I
need 
to use to get the current date/time?

Message #5 by Mindy Leslie <mindyjeanne@y...> on Sun, 21 Apr 2002 17:58:03 -0700 (PDT)
--0-704838147-1019437083=:5357
Content-Type: text/plain; charset=us-ascii


 I'm glad you misunderstood his post, what you wrote, may help me debug something.  Or determine if the dang server is misbehaving!
Mindy Jeanne
  "Minh T. Nguyen" <nguyentriminh@y...> wrote: jmlatham,

Sorry for my previous long post, but apparently I read your
question wrong. :) You just wanted to know a function to get the time,
and for some strange reasons, I've read that you wanted to time your
function. So, yeah, please ignore my previous long post. :)

Minh.

-----Original Message-----
From: jmlatham [mailto:Marshall@n...] 
Sent: Friday, April 19, 2002 9:54 PM
To: ASP+
Subject: [aspx] Date and Time


In ASP I code use functions like time(), date(), and now() to get and 
display the current date/time. Is there an equivalent in C# embedded in

an aspx to get that information? Is there a special namespace that I
need 
to use to get the current date/time?




---------------------------------
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more

  Return to Index