So, I use the wp-slimstat for purposes of tracking some statistics on this website, and I am lovin’ it although it is largely unsupported. I’d like to present a humble solution to a Local Timezone problem I’ve been having.
The problem: Wp-Slimstat’s time would be offset by a few hours, as it would only grab the server’s time. The problem is my server is in Los Angeles, and I am in Toronto. Result? The time for all the stats would be off by 3 hours. Bleh. :(
Well, there is a hack, if your Server has PHP5 (if you want to check out what version your server has, go here)
The Solution: Use the date_default_timezone_set function!
Basically, this will set a default timezone for a given script if you give it the proper location from where you are, rather than displaying the server’s default timezone. Luckily Wp-SlimStat is a single script — wp-slimstat.php — and so adding a single line of code with this function should affect the whole statistics package (and it did for me!)
This particular function requires a single argument, and that is the location.
It just so happens that there is an index for where you can find your own location, and how format that Argument.
For example, I am in Toronto, Canada. Therefore, I added “America/Toronto” to the arguments, so it ended up being:
date_default_timezone_set (”America/Toronto”);
Here’s how you can do it too:
Step 1. Open up wp-slimstat.php in your favourite text editor (I use PSPad).
Step 2. Find somewhere early in the plugin to pop in the script. I think line 30 should be fine.

Step 3. Insert your line of code (I also included a Comment).

Step 4. Save, upload, and there should be an automatic change!

Well, I hope that was pretty self-explanatory.
This was sort of crucial for me, as I often post after-midnight local time — and the stats would show that people would be arriving BEFORE my post. It would drive me crazy! Anyway, enjoy! And as always, support the author (particularly if you read Italian), who is doin’ some great work. Lavoro grande!

3 Comments
Good! It works fine, thanks for your sharing. :)
I’m glad you found it useful! :)
Thanks for stopping by.
hi thanks for sharing! nice tweak, but i have other sites under PHP4 any suggestions?
2 Trackbacks
[...] my wp.But I find it display this server time,not my local time. I google and find the answer from Deep Jive’s site. I put a line of code (as follow) into wp-slimstat.php,then it works fine. Thanks for Deep [...]
[...] public links >> slimstat How to Get WP-SlimStat to Recognize Your Local Timezone Saved by gisiger on Mon 08-9-2008 かんのものおき " Wp-SlimStat-Ex アクセス解析 [...]