-
To create an object and set the date to JULY 28, 2018, which one of the following statement should be executed?
-
- $date = DateTime(“28 JULY 2018”)
- $date = new DateTime(“28 JULY 2018”)
- $date = Date(“28 JULY 2018”)
- $date = new Date(“JULY 28 2018”)
- None of these
Correct Option: B
The dateTime() method is class constructor. You can set the date either at the time of instantiation or later by using a variety of mutators.