Thread: Days left

    #1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    10
    Rep Power
    0

    Days left


    Hello All,

    I have the following. I want to give my users 10 days to access a part of my website. I also want to print the days a user has left in their 10 day subscription. I am using the Day(Now) function to insert 2 numeric values into 2 fields in my DB. A field called StartDate and a field named EndDate. Sometimes the EndDate is smaller than the start day which results in a negative number. Can someone point me in the right direction?

    Here is what I am using

    Start_Num = Day(Now)
    End_Num = Day(Now) + 10

    If End_Number > Start_Num Then
    Total_Days = End_Num+31-Start_Num
    Else
    Total_Days = End_Num - Start_Num
    End If

    If Total_Days < 10 Then
    Response.Write("You have" & " " & Total_Days & " " & "days remaining")
    Else
    Response.Write("Your Days are through")
    End If

    Comments on this post

    • JimmyGosling agrees
  2. #2
  3. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2003
    Posts
    2
    Rep Power
    0
    Try looking at the datediff and dateadd funtions, use full dates, that makes it much easier to calculate the number of days left

    Comments on this post

    • JimmyGosling agrees

IMN logo majestic logo threadwatch logo seochat tools logo