[English Tutorial] PHP convert timezones

There are times when you would like to convert a Timezone (say America/New_York) to another Timezone (say UTC)

With classes such as DateTime and DateTimeZone available from php 5.2+ this task has become piece of cake.

Let me show you how its done.

In our example we will be converting

America/New_York to UTC time

Good thing is that Day light savings are taken into consideration automatically.

Code snippet


This is it you can create a function for the above code in your Util class as shown below and get some conversions happening.

 Generic Function







Share this Post :

No comments yet.

Please Post Your Comments & Reviews

Your email address will not be published. Required fields are marked *