SimplePie 1.3.1 is now available. Upgrade now!

SimplePie Documentation.  Learn how to use this thing.  It's way better than going to school.

You are here: Documentation » Tips, Tricks, Tutorials, and Screencasts » Changing timezones in a timestamp

Changing timezones in a timestamp

By default PHP's date() function (and in turn, SimplePie's get_date() method) return the timestamp according to the web server's timezone. But what if your timezone and your server's are different and you want to display yours?

PHP 5.1 or newer

Use the date_default_timezone_set() function with a timezone parameter from the timezone page. This should be set before PHP's date() or SimplePie's get_date() is called.

date_default_timezone_set('America/Los_Angeles');

PHP 5.0.x or earlier

Use the putenv() function as documented in this comment.


tutorial/changing_timezones_in_a_timestamp.txt · Last modified: 2011/03/05 19:56 (external edit)