Home » PHP » PHP Date/Time » Question
  1. Which of the following is the right way to use the DateTime class?
    1. $date = new class DateTime();
    2. $date = new DateTime();
    3. $date = class DateTime;
    4. $date = get_Class(DateTime);
    5. None of these
Correct Option: B

he way you use the DateTime class is like any other class: instantiate an object, and store it in a variable.



Your comments will be displayed only after manual approval.