CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2005
    Posts
    127

    date of week in month

    Dear all
    what's c++ function name is can use to know the
    date of week in month
    for example
    today is 2007-12-19
    this the day = 19 in this month is 3 weeks pass in this month
    how if the day = 25 is next week in this month .
    my question is does any idea i can use code to calculate which day of week in each month?

    thank's

  2. #2
    Join Date
    May 2002
    Posts
    1,435

    Re: date of week in month

    Are you asking which week of the month a specific day is in? For example, 2007-12-19 is in the 3rd week and 2007-12-25 is in the 4th week?

    If you could clarify the question you may get more replies.

  3. #3
    Join Date
    Oct 2002
    Location
    Timisoara, Romania
    Posts
    14,360

    Re: date of week in month

    There is no such C++ function. You have to compute that by yourself.
    Marius Bancila
    Home Page
    My CodeGuru articles

    I do not offer technical support via PM or e-mail. Please use vbBulletin codes.

  4. #4
    Join Date
    Feb 2000
    Location
    Indore, India
    Posts
    1,046

    Re: date of week in month

    Hello,

    As Cilu said, there is no ready-made C function to compute this. Moreover, week has different conventions in different countries and contexts like starting from Sunday, Monday or Saturday. One has to do the computation according to one's needs.

    Easiest method is to find the day from the date variable and divide the difference by 7 to get the week. One can refine the computation by checking which is the weekday of first of that month and which is the weekday on which the week starts.

    Regards,
    Pravin.
    Let me know if I have helped by rating this post

    Recent FAQs

    Drag an image
    Area of a window exposed on desktop
    Display rotated bitmap

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

Featured