Results 1 to 4 of 4

Thread: day monday

  1. #1

    Thread Starter
    Member
    Join Date
    Nov 1999
    Location
    panama
    Posts
    57

    Cool

    how say the monday for next week example:

    if day es tuesday how say the next monday the date

    EX: tuesday 29/8/00 the next monday is 4/9/00

    else is thursday or friday or saturday or sunday ever say the next monday of next week

    sorry my bad english

    thanx

    carlosapv
    [email protected]
    THE TRUTH IS OUT THERE
    Visual Basic 6.0 SP5

  2. #2
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Here's an example:
    Code:
    Dim dte As Date
    Dim iAdd%
    dte = InputBox("Enter a valid date")
    iAdd = 8 - Weekday(dte, vbMonday)
    MsgBox "Next monday is: " & DateAdd("d", iAdd, dte)

  3. #3
    Former Admin/Moderator MartinLiss's Avatar
    Join Date
    Sep 1999
    Location
    San Jose, CA
    Posts
    33,431
    I like Joacim's answer, but here is another way
    Code:
        Dim intDay As Integer
        
        For intDay = 1 To 7
            If Format(Date + intDay, "ddd") = "Mon" Then
                MsgBox "Next Monday is " & Date + intDay
                Exit For
            End If
        Next

  4. #4
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649
    Well Martin that assumes that the Format function will return "Mon" for monday.
    That may not be True. It depends on the locals setting. My computer returns "Mån" because I'm located in Sweden.

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