When I use the DateInterval class it returns a property names "d" and then another property names "Days" I am really confused on what is the difference between the two. Can someone please explain.
Below is an example of the object that was returned in my code.
DateInterval(
y =
0
m =
1
d =
1
h =
3
i =
16
s =
6
weekday =
0
weekday_behavior =
0
first_last_day_of =
0
invert =
1
days =
31
special_type =
0
special_amount =
0
have_weekday_relative =
0
have_special_relative =
0
d
- the days (Feb 23 - Jan 1).d == 22
)days
- the total number of days - (Feb 23 - Jan 1).days == 31 + 22
)From the documentation:
d
Number of days.
days
If the DateInterval object was created by DateTime::diff(), then this is the total number of days between the start and end dates. Otherwise, days will be FALSE.
Before PHP 5.4.20/5.5.4 instead of FALSE you will receive -99999 upon accessing the property.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With