Results 1 to 4 of 4

Thread: How to Get the Date(Moday - Sunday) Info

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2008
    Posts
    4

    How to Get the Date(Moday - Sunday) Info

    Hi,
    Code:
        
        Any solution given if i would like to get  next week "moday- sunday". 
    
    For Example :   
       Today is 08/08/2008 - wednesday
       Next Week 24/08/2008 - Moday
    
     ----------------------------------------------------
    Mon(24/08/2008)| Tue(25/08/2008)| Wed(26/08/2008)|
    -----------------------------------------------------
    thanks for any reply.

    VbForum ... is the best for vb...

  2. #2
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    Re: How to Get the Date(Moday - Sunday) Info

    Is this what you want?

    Code:
    Sub DayWeekName()
        'This will give you Wednesday
        MsgBox Format(#8/20/2008#, "dddd")
    End Sub
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  3. #3
    PowerPoster
    Join Date
    Nov 2002
    Location
    Manila
    Posts
    7,629

    Re: How to Get the Date(Moday - Sunday) Info

    If this is an exercise then I'll give narrative requirements spec so there's effort on your part and you learn.

    If your no longer a student or already a professional, then I'll still give you narrative requirement as you should already know how to read such by now.

    If you add 7 then you will get same day next week... so you need to subtract x number of days to reset date to target start date (monday)... to know how many days to subtract you need to get ordinal position (1-7) of given date... you can use WeekDay() function for this with start of week specified... simple arithmetic would then yield date of target start date (monday)... you would then just loop 7 times to get the dates from target start date (monday) to sunday.

  4. #4
    Head Hunted anhn's Avatar
    Join Date
    Aug 2007
    Location
    Australia
    Posts
    3,669

    Re: How to Get the Date(Moday - Sunday) Info

    A good lecturer, leinad.
    I intended to give him the code but let him try first.
    • Don't forget to use [CODE]your code here[/CODE] when posting code
    • If your question was answered please use Thread Tools to mark your thread [RESOLVED]
    • Don't forget to RATE helpful posts

    • Baby Steps a guided tour
    • IsDigits() and IsNumber() functions • Wichmann-Hill Random() function • >> and << functions for VB • CopyFileByChunk

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