locked
Access - Calculate Weekday in Date format RRS feed

  • Question

  • I am unable to clearly identify (or interpret may be the right word) the calculation of a week day.

    Here is an example of the result I would like:

    [Date] + [NumberOfDays] resulting in weekday date.

    i.e., Monday, January 2, 2017, add 30 days (including counting weekends) results in Tuesday, January 31, 2017

    I have looked for a solution to this for nearly two days and now completely confused, if the answer was right there in front of me, I wouldn't have any idea.

    Thank you for any assistant you can offer!

    Friday, August 11, 2017 3:23 PM

Answers

  • Do you know this forum is for SQL Server (TSQL)? Please ask your Access question in other forum. Thanks.
    • Marked as answer by Deni-921 Friday, August 11, 2017 6:27 PM
    Friday, August 11, 2017 3:38 PM
  • If you add 30 days to Monday, January 2 it will give Wednesday, February 1 not Tuesday, January 31.

    To add number of days to a date, this is the function you have to use :

    SELECT DATEADD(d,30,'2017-01-02')


    Ousama EL HOR, MCSE|MCSA|MCP. Please mark as answered, If you feel happy with this answer.


    • Edited by Ousama EL HOR Friday, August 11, 2017 3:48 PM
    • Marked as answer by Deni-921 Friday, August 11, 2017 6:27 PM
    Friday, August 11, 2017 3:44 PM

All replies

  • select dateadd(d,29,'2017-01-02')

    Please mark as answer if this post helped you

    Friday, August 11, 2017 3:30 PM
  • Do you know this forum is for SQL Server (TSQL)? Please ask your Access question in other forum. Thanks.
    • Marked as answer by Deni-921 Friday, August 11, 2017 6:27 PM
    Friday, August 11, 2017 3:38 PM
  • If you add 30 days to Monday, January 2 it will give Wednesday, February 1 not Tuesday, January 31.

    To add number of days to a date, this is the function you have to use :

    SELECT DATEADD(d,30,'2017-01-02')


    Ousama EL HOR, MCSE|MCSA|MCP. Please mark as answered, If you feel happy with this answer.


    • Edited by Ousama EL HOR Friday, August 11, 2017 3:48 PM
    • Marked as answer by Deni-921 Friday, August 11, 2017 6:27 PM
    Friday, August 11, 2017 3:44 PM
  • I have the addition of dates down ok; I miscalculated my example as was noted from another following post.  I'm trying to get the calculated date to result in a weekday.  I.e., if the calculated date ends on a Saturday or Sunday, I want it to round to the following Monday.  This is for a litigation databank, therefore if a filing due date is a weekend, the pleading cannot be filed until the following Monday.

    But I understand from another post that follows, I should be posting my question to a Access forum.  I found several questions on other matters in this forum and found it helpful when locating other answers. 

    I'll pose my question to a dedicated Access form. 

    Thank you everyone!  I'm new to this Q&A forum--thank you for being tolerant.

    Friday, August 11, 2017 6:27 PM
  • You should use a calendar table, no matter you are on SQL Server or Access. This article for Ed Pollack explains the concept. It's written for SQL Server, but you can adapt the idea for Access.
    https://www.sqlshack.com/designing-a-calendar-table/

    Friday, August 11, 2017 10:01 PM