I am gosting with GoDaddy and the time seems to be 2 hour behind, I live in UK. i tried putenv("TZ=Europe/London"); PHP: but that didnt work Any ideas?
Tried that and i get this... Fatal error: Call to undefined function: date_default_timezone_set() in /home/content/a/m/a/username/html/includes/functions.php on line 7 Code (markup):
You should ask your host to upgrade to PHP 5, since support for PHP 4 is ending this year. (And having this function is really useful too) Anyway, there are 2 workarounds now: Use date() along with strtotime() to add 2 hours to the current timestamp. echo date('H:i:s', strtotime('+2 Hours')); PHP: Or: Place this once at the top of your script: setlocale(LC_TIME, 'en_UK', 'english-uk', 'uk', 'eng'); PHP: And then use strftime() to format the date.
But the date function is on at least 50 pages so i wanted a function i could add to the functions page which is included on every page.
Have a look at the control panel of your host. Some of them have an option to switch between PHP 4 and PHP 5. Try enabling PHP 5 if you can. (Then try the first code again) Other than that, I don't think there's a way you can change the timezone so that date() displays all dates automatically right.