On 12/2/14 2:00 PM, H. S. Teoh via Digitalmars-d-learn wrote:
On Tue, Dec 02, 2014 at 06:49:54PM +0000, via Digitalmars-d-learn wrote:
But still, why this method
http://dlang.org/phobos/std_datetime.html#.Date.add only supports "month"
or "years" while this one
http://dlang.org/phobos/std_datetime.html#.Date.roll does ?

But still, why this method
http://dlang.org/phobos/std_datetime.html#.Date.add only supports
"month" or "years" while this one
http://dlang.org/phobos/std_datetime.html#.Date.roll does support days
?*

Hmm. Looks like an oversight. File a bug?

Not an oversight.

Date.add and Date.roll are for adding units that are variable.

For example, how many days are in a month? Answer: depends on the month. How many days in a year? Answer: depends on the year.

But days are NOT variable, there are exactly 24 hours in a day. So to add a day, you just add a day with +=.

-Steve

Reply via email to