sharing small pieces of rocks or jewels I find on the way

WAMP time zone problem

WAMP doesn’t configure time zone as Apache default installation will do. So, by default it takes GMT 0. If the server is located somewhere else make sure to set the time zone. I used date_default_timezone_set(‘Asia/Dhaka’); to set my timezone because the server was in Dhaka. The list of time zones available here

This caused me quite pain for 2 hrs today and searching with WAMP time zone problem I didn’t find anything so thought people may need πŸ™‚


Comments on: "WAMP time zone problem" (12)

  1. I’m having a problem that might be related to that. I’m new to web developing and trying to learn as much as I can.

    I’m running WAMP on Mac OS and can’t find an explanation to why the server’s default timezone sets to Europe/Paris(GMT+1), when my system’s timezone is set to Europe/Lisbon (GMT).

    I’m calling the server timezone with the php method date_default_timezone_get()

    The strange thing is that when I change my system’s timezone, and refresh the php file, the default server’s timezone updates to a new timezone, which in most cases matches my system’s timezone, and SOMETIMES presents a slight difference, like Lisbon – Paris.

    This doesn’t make any sense to me.

    I know this is an old post but if you can help i would be most grateful!

    • go mamp icon -> click and go php -> find php.ini -> open in notepade press ctrl+f find timezone and change the defult value by putting yours on. all finish restart all services.

  2. Edit: it’s actually WAMP I’m running, the OS X equivalent of MAMP

  3. Hi Rafa,
    I believe you will have to set server’s time zone using date_default_timezone_set(), then it should work. Your problem is similar to mine I believe. You might be using a common include.php or config.php, there just set the timezone, then it should be working perfect.

  4. yeah this problem is very annoying… the php.ini configuration wont work, but the date_default_timezone_set() will do. its not a problem if your using manual hard coding by just including it in every page, but it a headache when using OSCMS and OS Framework.

  5. So what precisely does one do to fix this problem?

  6. Thanks Raisul.
    date_default_timezone_set() worked. πŸ™‚

  7. Helpful post – I ended up configuring php.ini to date.timezone = Africa/Johannesburg

    which saved the day.

    Many thanks

  8. great work craig realy helped me to. Thanks

  9. thank you it works for me too :)))
    using this lline of a script
    funded here :

  10. where should i put this date_default_timezone_set() ? plzz help asap !

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: