Re: timer function
From: Philipp Sumi (spameater_at_thisdomaindoesntexist.org)
Date: 11/08/04
- Next message: Scott Allen: "Re: dynamically loading usercontrols (vb.net)"
- Previous message: Philipp Sumi: "Re: xml and email?"
- In reply to: TJS: "timer function"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 08 Nov 2004 01:38:30 +0100
Hi,
This look pretty complicated :-)
Why don't you just store the DateTime directly in to Session?
Code is C#, but I think you get the idea...
store in session
****************
//store initial value:
Context.Session.Add("LastAccess", DateTime.Now);
get elapsed time
****************
//get time passed:
DateTime lastAccess = (DateTime)Session["LastAccess"];
//get the elapsed time
TimeSpan difference = DateTime.Now.Subtract(lastAccess);
hth, Philipp
TJS wrote:
> looking for example of timer function
>
> something that will help me get to track user's elapsed time since last
> refresh.
>
> tried this but not working with session values correctly in my class
>
> ================================================================
> Function NewText() As String
>
> Dim vString As String=" "
> Dim dtm As DateTime
> dtm = DateTime.Now()
>
> If context.session("ScreenTimer") is nothing Then
> context.session("ScreenTimer") = Hour(dtm) * 60 + Minute(dtm)
> else
> context.session("TimeElapsed") = Hour(dtm) * 60 + Minute(dtm) -
> cDBL(context.session("ScreenTimer"))
> end if
>
> If context.session("TimeElapsed") > 1 Then
> vString= "new text here"
> context.session("ScreenTimer") = Hour(dtm) * 60 + Minute(dtm)
> End If
> return vString
> End Function
>
>
- Next message: Scott Allen: "Re: dynamically loading usercontrols (vb.net)"
- Previous message: Philipp Sumi: "Re: xml and email?"
- In reply to: TJS: "timer function"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|