1.

Which of the following statements can be used to set the time zone in individual scripts?(a) date_set_timezone(‘Europe/London’);(b) date_default_timezone_set(‘Europe/London’);(c) date_set_default_timezone(‘Europe/London’);(d) date_default_timezone(‘Europe/London’);I had been asked this question during an interview for a job.My query is from Working with Dates in section File and Session Handling in PHP of PHP

Answer»

The correct answer is (b) date_default_timezone_set(‘Europe/London’);

Explanation: The FUNCTION date_default_timezone_setis used to set the default time ZONE used by all date/time functions in a script. You can also USE ini_set(‘date.timezone’, ‘Europe/London’);



Discussion

No Comment Found

Related InterviewSolutions