Home » PHP » PHP Date/Time » Question
  1. Which of the following statements can be used to add two months to the existing date?
    1. $date = modify(‘+2 months’);
    2. $date->modify(‘2+ months’);
    3. $date->modify(‘+2 months’);
    4. $date = modify(‘2+ months’);
    5. None of these
Correct Option: C

To change the date stored by a DateTime object after it has been created, you use DateTime::modify() with a natural language expression.



Your comments will be displayed only after manual approval.