gopal3
asked on
dateadd function returns weekends even when weekday "w" is specified
dateadd function returns weekends even when weekday "w" is specified . Example, day_1: DateAdd("w",-1,Histmf_8002 _02_1!date )
returns Sunday 10/21/2001 when given Monday 10/22/2001 as date. day_1: DateAdd("w",1,Histmf_8002_ 02_1!date) returns Saturday 10/20/2001 when given 10/19/2001 as date.
Is there a fix or workaround?
returns Sunday 10/21/2001 when given Monday 10/22/2001 as date. day_1: DateAdd("w",1,Histmf_8002_
Is there a fix or workaround?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
gopal3,
No comment has been added lately (68 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
RECOMMENDATION: Award points to RemRemRem http:#8243435
Please leave any comments here within 7 days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thanks,
TextReport
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post a request in Community support (with a link to this page) to refund your points. https://www.experts-exchange.com/Community_Support/
No comment has been added lately (68 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:
RECOMMENDATION: Award points to RemRemRem http:#8243435
Please leave any comments here within 7 days.
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
Thanks,
TextReport
EE Cleanup Volunteer
---------------------
If you feel that your question was not properly addressed, or that none of the comments received were appropriate answers, please post a request in Community support (with a link to this page) to refund your points. https://www.experts-exchange.com/Community_Support/
this function is wrong!
add 4 working days to Thurs, should give Wed.
The function only accounts for end date LANDING on a weekend.
see http://support.microsoft.com/kb/115489
add 4 working days to Thurs, should give Wed.
The function only accounts for end date LANDING on a weekend.
see http://support.microsoft.com/kb/115489
To get the work week days (Mon -- Fri), you will have to do some additional coding, e.g.:
iif(WeekDay(Dateadd("d", [Days], Histmf_8002_02_1!date)) = 7, iif(Sgn([Days])>=0, Dateadd("d", [Days]+2, Histmf_8002_02_1!date), Dateadd("d",[Days]-1, Histmf_8002_02_1!date)), iif(WeekDay(Dateadd("d", [Days], Histmf_8002_02_1!date)) = 1, iif(Sgn([Days])>=0, Dateadd("d", [Days]+1, Histmf_8002_02_1!date), Dateadd("d",[Days]-2, Histmf_8002_02_1!date)), Dateadd("d", [Days], Histmf_8002_02_1!date))
This, of course, is not a full solution. If you wanted to go 30 working days out, you would need to adjust for multiple weekends between the start date and the end date.