Mervli Türkmen Mervli Türkmen - 3 months ago 12
PHP Question

standart time for my website

I want to supply my site with standard time for prevent confusion. I simple use this code

time ();
for getting time. But this function uses system's time. How can I make standard time for all users which is independent from computer's time.

Answer

You need to set the default time/zone which is then used by all date/time functions in your script

date_default_timezone_set('Europe/London');

$current_date = date('d/m/Y == H:i:s');

It would be advisable that you set this in your php.ini file but the fact your asking something so basic I guess you're on a shared host and don't have access to the ini file so the code above is fine.

http://php.net/manual/en/function.date-default-timezone-set.php

Comments