Results 1 to 2 of 2

Thread: how to get the date & time of NEXT week's first day

  1. #1

    Thread Starter
    Member shamloo's Avatar
    Join Date
    Oct 2000
    Location
    Stockholm, Sweden
    Posts
    32

    how to get the date & time of NEXT week's first day

    I'm creating an ASP-Poll and do not want the users to vote more than once a week and therefore I'm making this cookie.
    The cookie should expire the first day, at 00:00:01, of the FOLLOWING week, that's what I have in mind.
    an example might be necessary)
    a user votes on a thursday, week 27. Then he/she will not be able to vote again until monday 00:00:01, week 28.
    And when he/she votes again the poll has changed(I have this working), the main purpose of the cookie is to make sure people never votes more than once!

    I get the current week by doing this:
    Dim myWeek
    myWeek = DatePart("ww",Date(),2,2)

    --------------------
    so, what I need help with here is how to get the first date & time from the following week's first day(which is monday here in Sweden).

    thanks,
    David
    "There are no must's in life unless you provide for someone else than yourself"

  2. #2
    Black Cat JoshT's Avatar
    Join Date
    Nov 2000
    Location
    WNY, USA
    Posts
    4,032
    See if you can modify this to meet your needs.

    Code:
    Function GetWeekBeginning(theDay)
        'takes a date, sees if its the beginning of the week
        '   if is not returns the beginning date of the week
        '   uses Sunday as beginning day of week
        Dim temp
        temp = Weekday(theDay)
        Do Until temp = vbSunday
            theDay = DateAdd("d", -1, theDay)
            temp = Weekday(theDay)
        Loop
        GetWeekBeginning = theDay
    End Function
    Josh
    Get these: Mozilla Opera OpenBSD
    I have books for sale: "MCSD in a Nutshell" and "VB Distributed Exam Cram" - PM me for details. Will also trade for a decent ATX Pentium 2 MB/CPU/RAM combo.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width