Home / CSE / PHP - CS :: Discussion

Discussion :: PHP - CS

  1. Which of the following is the right way to use the DateTime class?

  2. A.

     $date = get_Class(DateTime);

    B.

     $date = class DateTime;

    C.

     $date = new DateTime();

    D.

     $date = new class DateTime();

    View Answer

    Workspace

    Answer : Option C

    Explanation :

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


Be The First To Comment