Newdate/ASP

They have: 133 posts

Joined: Sep 2000

I have a question - again.

As you might know, I am in the process of creating a forum (actually already done), but I need a little help with some extra features.

I want to be able to see if the threads is new for the person. The question is - how do I do that?

I believe that the best way to do it is to save a cookie on the clients computer (on in a database or whatever), and then combine all the threads with the date that cookie contains.
The problem is, how do I check if the date is newer than what he has stored?

I would think it should be done something like this:

---
lastvisit = request.cookies("lastvisit")
latestpost = objCon("lastpost")

if isnewer(lastvisit, latstpost) then
'not a new thread
else
'new thread
end if
---

However, all of us know that this doesn't work.
I recon that there is a function that allows me to check it like this, but I don't remember it!
Can someone help me?

Thanks in advance
¨~VCasper

PS: If you wanna see the forum I am talking about, go to secretsofwar.net, log in (or sign up) and got o features, and then to the new forums.

Peter J. Boettcher's picture

They have: 812 posts

Joined: Feb 2000

There's a couple ways to do this:

If CDate(lastpost) > CDate(lastvisit) Then
'new thread
Else
'old thread
End If

OR

If DateDiff("h",CDate(lastvisit),CDate(lastpost)) > 0 Then
'new thread
Else
'old thread
End If

The "h" is for hour, so the DateDiff compares the results down to the hour.

PJ | Are we there yet?
pjboettcher.com

They have: 133 posts

Joined: Sep 2000

Thank you!

It works perfectly!

This is the best source to knowledge; these forums are great! (not as great as what I am making, but still... Smiling)

Have a good one!
~Casper

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.