Submit Your Article Webforumz RegistrationAnnouncements Contact Webforumz StaffContact
Home Resources Blogs Meet the Team Contact Register
 

Go Back   WebForumz.com > The Code > Classic ASP

Reply
 
LinkBack Thread Tools
Old October 25th, 2007, 05:48 AM   #21
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,628
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: Your last visit is Today??

Ohh I see.. I get the idea now. Let me go back and play with my code.
I'll let you know yesterday! I mean tomorow.. lol

Thanks..
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 25th, 2007, 05:55 AM   #22
Highly Reputable Member
 

Join Date: Apr 2007
Location: Willich, Germany
Age: 22
Posts: 592
Blog Entries: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough c010depunkk is a jewel in the rough
Re: Your last visit is Today??

Code:
<?php
echo('Your last visit was '.($row['lastvisited']==$todays_date?'Today':($row['lastvisited']==$yesterdays_date?'Yesterday':$row['lastvisit'])).'!');
?>
c010depunkk is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 25th, 2007, 05:58 AM   #23
WebForumz Admin Badge
SuperMember
 
Marc's Avatar
 

Join Date: Apr 2007
Location: Scotland, UK
Posts: 2,086
Thanks: 2
Thanked 23 Times in 23 Posts
Rep Altering Power: 89 Marc is just really nice Marc is just really nice Marc is just really nice Marc is just really nice
Re: Your last visit is Today??

Go away... Smartie pants... lol
__________________
Regards
Marc
Administrator - Webforumz.com

Web Design and Development Blog - Marc Fraser
Marc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 25th, 2007, 06:36 AM   #24
Rob
Elite Veteran
SuperMember
 
Rob's Avatar
 

Join Date: Jul 2003
Location: Southern UK
Age: 35
Posts: 3,126
Blog Entries: 7
Thanks: 28
Thanked 22 Times in 19 Posts
Rep Altering Power: 0 Rob is a jewel in the rough Rob is a jewel in the rough Rob is a jewel in the rough
Re: Your last visit is Today??

Instead of this code
Code:
dim dd, mm, yyyy, newtime, newdate
        dd=day(date)
    if len(dd)=1 then
        dd="0" & dd
    end if
        mm=month(date)
    if len(mm)=1 then
        mm="0" & mm
    end if
        yyyy=year(date)
    
    'getting new date
    newdate = dd & "-" & mm & "-" & yyyy
Use this:-
Code:
newdate = date(now)
DO NOT store 'today' in the database.... store an actual date/time instead

The correct method to show 'today' would be a comparison when displaying the thing....
not when entering it in the database.

Does that make sense?
__________________
Rob - Webforumz Founder
Web Designer Support Network || Personal Project: Sanctuary for Student Midwives

Last edited by Monie; October 25th, 2007 at 08:53 PM.. Reason: correcting the [CODE] tag, hehehe...
Rob is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 25th, 2007, 06:55 AM   #25
Elite Veteran
 
Daniel's Avatar
 

Join Date: Sep 2006
Location: Bridgnorth
Age: 23
Posts: 2,048
Blog Entries: 12
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Altering Power: 0 Daniel is a jewel in the rough Daniel is a jewel in the rough Daniel is a jewel in the rough Daniel is a jewel in the rough
Re: Your last visit is Today??

My head hurts
Daniel is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 25th, 2007, 07:07 AM   #26
WebForumz Admin Badge
SuperMember
 
Marc's Avatar
 

Join Date: Apr 2007
Location: Scotland, UK
Posts: 2,086
Thanks: 2
Thanked 23 Times in 23 Posts
Rep Altering Power: 89 Marc is just really nice Marc is just really nice Marc is just really nice Marc is just really nice
Re: Your last visit is Today??

Quote:
Originally Posted by Daniel View Post
My head hurts
Thats ASP for ya
__________________
Regards
Marc
Administrator - Webforumz.com

Web Design and Development Blog - Marc Fraser
Marc is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old October 25th, 2007, 09:06 PM   #27
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,628
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: Your last visit is Today??

Hey guys.. check out what I've come up with!

I don't know if this way can be consider a "creative" way, but I have accomplished what I am trying to get.

It's not a PHP code, I just use the php tag so that I get a nice colorful ASP code, lol.

Code:
<%    
    dim dd, mm, yyyy, newtime, newdatetoday, newdateyesterday, newdatelastweek, lastweek, yesterday

    dd = day(date) //todays date
    yesterday = dd - 1 //yesterdays date
    lastweek = dd - 7 //last week date
    mm = month(date)    
    yyyy=year(date)

    If Len(dd) = 1 Then
        dd="0" & dd //Add '0' to DD that start with 1-9
    End If    
   
    If len(mm) = 1 Then
        mm="0" & mm
    End If    
    
    //Todays date
    newdatetoday = dd & "-" & mm & "-" & yyyy
    //Yesterdays date
    newdateyesterday = yesterday & "-" & mm & "-" & yyyy
    //Last Week date (exactly 7 days ago)
    newdatelastweek = lastweek & "-" & mm & "-" & yyyy
    //Get time
    newtime = time()
  
    dim lastvisit
    lastvisit = rs("lastactivedate")
       
    If (cdate(lastvisit)) = (cdate(newdatelastweek)) Then
        lastvisit = "Last Week"
    Else If (cdate(lastvisit)) = (cdate(newdateyesterday)) Then
        lastvisit = "Yesterday"
    Else If (cdate(lastvisit)) = (cdate(newdatetoday)) Then
        lastvisit = "Today"
    Else    
        lastvisit = rs("lastactivedate")
    End If
%>
Your last activity: <%Response.Write(lastvisit)%>

CDate function converts a valid date (and time) expression to type Date. After converting them, I found out I can make the comparison directly. I don't know if this can be done in PHP?

Hey Rob, I'll check out your code!

Last edited by Monie; November 2nd, 2007 at 01:56 AM..
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Old November 1st, 2007, 01:16 AM   #28
Most Reputable Member
 

Join Date: Feb 2004
Location: Borneo
Age: 28
Posts: 1,628
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Rep Altering Power: 0 Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough Monie is a jewel in the rough
Re: Your last visit is Today??

I got it the updated version, much more structured and understandable:

Code:
<%    
    Dim todaytime, todaydate, yesterdaysdate, lastweekdate

    todaydate = (cdate(date())) 'today date
    yesterdaysdate = (cdate(date())) - 1 'yesterdays date
    lastweekdate = (cdate(date())) - 7 'lastweek date
    todaytime = FormatDateTime(Now(), vbShortTime) 'show today time in mm:hh format (24 hour clock)

    If Session("name") <> "" Then
        dim lastvisit
        lastvisit = rs("lastactivedate")
        
        If lastvisit <> "" Then
            If (cdate(lastvisit)) = lastweekdate Then
                lastvisit = "Last Week"
            ElseIf (cdate(lastvisit)) = yesterdaysdate Then
                lastvisit = "Yesterday"
            ElseIf (cdate(lastvisit)) = todaydate Then
                lastvisit = "Today"
            Else    
                lastvisit = rs("lastactivedate")
            End If
        End If
    End If    
%>
Code:
<body>
   You last visited: <%Response.Write(lastvisit)%>
</body>

Last edited by Monie; November 2nd, 2007 at 01:55 AM..
Monie is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Spurl this Post!Reddit! Wong this Post!
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Visit Falmouth Jack Franklin How is this done? 4 March 29th, 2008 10:52 AM
Last Visit? Last Activity? Monie Classic ASP 5 January 2nd, 2008 09:59 PM
visit from an old friend ! bruno89 The Café 27 October 28th, 2007 07:05 PM
[SOLVED] User Last Visit Status Monie Classic ASP 3 October 9th, 2007 11:03 PM
Googlebot Visit ????????? Merlin The Café 3 September 30th, 2007 08:55 PM


Search Engine Optimization by vBSEO 3.2.0 RC8