Today is Friday, April 17, 2015. In my app, it automatically generated a "due date" for each assignment. It's set to "5 business days". To accomplish this, We use:
date('m/d/Y', strtotime("+5 weekdays"));
However, today, this output "04/26/2015". Why? That's a sunday. Why doesn't it give me the 24th, which is what I want?
DEMO: http://codepad.org/2wvnypOC
P.S. After speaking to my boss, we switched to strtotime("+5 days")
, but I'm still curious what was wrong with "weekdays"
.
\DateTime
approach now that is preferable? I tend to shundate
/strtotime
these days. – Hewes$date = new DateTime("2015-04-17"); $date->modify("+5 weekdays"); echo $date->format("Y-m-d");
with the same result... – Truss