week day of the year

Posted on 2011-10-17
Last Modified: 2012-05-12
How can i find week day of the year,using REXX.
Any help would be welcome,Thanks
Question by:Sandeepiii
    LVL 68

    Expert Comment


    what is a week day "of the year" for you?

    The weekday can be obtained with

    say date('W')


    Author Comment

    Thanks for your reply i mean to say that,
    For example Jan14th 2011 falls in which week,so i want a program which can be universal for any date which i input.
    LVL 68

    Accepted Solution

    There's no "number of week" calculation in the date function, unfortunately.

    You could get a rough approximation with this:

    say (date('D','20110114','S')+4)%7

    which is nothing else than a rounded integer division of the number of days elapsed in the year by seven.

    The format of the second parameter is determined by the third parameter, sou you could as well do:

    say (date('D','14 Jan 2011','N')+4)%7



    Author Closing Comment

    Answer was nice and accurate.
    LVL 68

    Expert Comment

    >> Answer was nice and accurate. <<

    Why did you give a grade "B" then?

    If this was a mistake please click"Request Attention" and have a moderator correct your decision.

    Thx for the points anyway!


    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Better Security Awareness With Threat Intelligence

    See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

    If you're not part of the solution, you're part of the problem.   Tips on how to secure IoT devices, even the dumbest ones, so they can't be used as part of a DDoS botnet.  Use PRTG Network Monitor as one of the building blocks, to detect unusual…
    Not sure what the best email signature size is? Are you worried about email signature image size? Follow this best practice guide.
    Need more eyes on your posted question? Go ahead and follow the quick steps in this video to learn how to Request Attention to your question. *Log into your Experts Exchange account *Find the question you want to Request Attention for *Go to the e…
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now