Of Timezones

If you are a novice (and a lazy bone) like me at PHP then most probably you are using XAMPP  . Now when I started tinkering with the functions , I stumbled upon the date() function and found it fascinating because of its many instant flavours. Now the date function without the code and .ini tinkering will give you UTC time. Who wants that in India :D.

So what did I do for getting apna BhartiyaStandardWaqt?


Go to <XAMPP_HOME>/apache/bin

Open php.ini 

Search for “date.timezone”

Uncomment it. How do you do it? Simply remove “;” present at the start.

Set the timezone to whatever you want. The list is here . For apna IST use ‘Asia/Calcutta’. For eg. date.timezone=”Asia/Calcutta”

Restart the server.

And Bingo you have it.

There is another way if you are interested. The code way. Use  : date_default_timezone_set(‘Asia/Calcutta’); before you use the date function.

enough. back to work. codebaba ki jai.