What is the best way of using DateDiff to compare two events, both of which have a date (dd/mm/yyyy) and a time (hh:mm:ss). Basically I am trying to make a bulletin board that displays how many messages have been posted since a user's last visit.
I have 4 variables:
DatePosted (this is the date the message was posted)
TimePosted (this is the time the message was posted)
DateVisited (this is the date of the user's last visit)
TimeVisited (this is the time of the user's last visit)
I think I need to have a nested If...Then...Else structure that looks does a DateDiff looking at the year part and if that is in the future then we can we don't have to worry checking other parts of the date. However it could be the same year but a different month so this would have to be checked. If the month was in the future then again we could bail out but it could be the same month but the day could be ahead. I would then go all the way down to the seconds part of the time posted and the timevisited.
Any ideas on how to actually put this together? I am having a nightmare with the logic!
Any help much appreciated.
Ed
I have 4 variables:
DatePosted (this is the date the message was posted)
TimePosted (this is the time the message was posted)
DateVisited (this is the date of the user's last visit)
TimeVisited (this is the time of the user's last visit)
I think I need to have a nested If...Then...Else structure that looks does a DateDiff looking at the year part and if that is in the future then we can we don't have to worry checking other parts of the date. However it could be the same year but a different month so this would have to be checked. If the month was in the future then again we could bail out but it could be the same month but the day could be ahead. I would then go all the way down to the seconds part of the time posted and the timevisited.
Any ideas on how to actually put this together? I am having a nightmare with the logic!
Any help much appreciated.
Ed