Well in shorter terms we bash our heads with confusion hoping for a nice and easy solution to it, but some of us just don’t have the patiences to do a bit of experimenting with PHP to find your own little fix-up. Anyway’s cutting to the chase I had this issue earlier when I was enhancing the site design where I used the date() function which was making the time one hour behind my timezone, so I was puzzled at that point so I got my hands dirty and found a nice little fix to make it show the correct time that it should do by default – as PHP date() only reads the Server Time/Date nothing else and I’m always against using JavaScript as you can never be 100% certain every visitor has JavaScript enabled! We have to think of those visitors who are browsing from their workplace/school/college etc.
So what is you’re little fix-up you may ask? Well seeing as you asked nicely check below and have a peak..
PHP:
date_default_timezone_set('Europe/London'); echo date('l jS F Y');
Obviously, remember to change the timezone to yours as ‘Europe/London’ is my timezone – if you don’t know what timezones are available for this function then go here.
And that is it my friends a very simple solution to the matter that takes no more than one line of code, however I would suggest writing up a better code if you wish to support every users timezone which I might cover in another tutorial (if you are lucky!).
If you need any help then please leave you’re comments below.



