Which of the following statements can be used to add two months to the existing date?
A. $date->modify(‘+2 months’);
B. $date = modify(‘+2 months’);
C. $date = modify(‘2+ months’);
D. $date->modify(‘2+ months’);
Answer: Option A
Solution(By Examveda Team)
To change the date stored by a DateTime object after it has been created, you use DateTime::modify() with a natural language expression.Related Questions on Date and Timestamp
A. TRUE
B. FALSE
C. Valid
D. Invalid
The date() function returns ___ representation of the current date and/or time.
A. Integer
B. String
C. Boolean
D. Float
If the format is F then which one of the following will be returned?
A. Complete text representation of month
B. Day of month, with leading zero
C. Daylight saving time
D. Day of month, without zeros
Join The Discussion