MyBB Community Forums

Full Version: php date echoing wrong date with correct unix time stamp
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Here is my unix time stamp: 1361491200

I've tried checking server time with date("d-m-y") and it is working fine.
but when i try to use this time stamp as

$string="1361491200";
echo date("d-m-y",$string);

and out put is: 21-02-2013

but the correct output is: 22-02-2013, so where i am getting it wrong ?
If you using hp 5.1 or greater, put this at the top of your file after <?php
date_default_timezone_set('UTC');

If the output is now correct, you need to change PHP's time zone, which is probably in php.ini
Its correct now, may I ask how can I change it if I have no control over php.ini i.e. in shared hosting
Using that code Smile that's an inline ini function Smile
Perfect! thank you