I am using date()
function in the format date('Y-m-d H:i:s')
. It shows 2013-11-22 06:26:25
when the actual time is 2013-11-22 11:56:25
.
My code,
echo $today = date('Y-m-d H:i:s');
I am using date()
function in the format date('Y-m-d H:i:s')
. It shows 2013-11-22 06:26:25
when the actual time is 2013-11-22 11:56:25
.
My code,
echo $today = date('Y-m-d H:i:s');
date function will display date according to timezone being set in php.ini configuration file on server.
So please set timezone on your server using date_default_timezone() function
For more details please refer the documentation mentioned in following url
http://php.net/manual/en/function.date-default-timezone-set.php
first set your time zone using this code
date_default_timezone_set('UTC');
find utc code of your country here
http://www.date-default-timezone-set.com/
then you can use
echo $today = date('Y-m-d H:i:s');