How to set your default sNews timezone using date_default_timezone_set

I live in Scotland while my website is hosted in Pittsburgh, USA. As sNews uses the server time to timestamp submissions my articles have the 'wrong' date-time - each article shows a time that is 5 hours behind my local time, the time at which I created and submitted the article.

There is no setting within sNews CMS to adjust the locale or time zone. It's necessary to open snews.php and add the following code, somewhere near the top of the file.

// Set local timezone
date_default_timezone_set('Europe/London');

The function date_default_timezone_set() has been available since PHP v5.1.

I have used Europe/London (I could have used Europe/Dublin, or Europe/Edinburgh - each is within the same time zone as my home town). Replace Europe/London with your own choice from this list.

An alternative method is to use

php_value date.timezone 'Europe/London'

in your .htaccess file.

Mon Aug 2009 20:25

Back to the top