Examveda
Examveda

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

A. $date = get_Class(DateTime);

B. $date = class DateTime;

C. $date = new DateTime();

D. $date = new class DateTime();

Answer: Option C

Solution(By Examveda Team)

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

This Question Belongs to PHP >> Date And Timestamp

Join The Discussion

Related Questions on Date and Timestamp