Try this
Check this How do i get the gmt time in php
date_default_timezone_set("UTC");
echo date("Y-m-d H:i:s", time());
gmdate()
is doing exactly what you asked for.
Look at formats here: http://php.net/manual/en/function.gmdate.php
You are repeating the y,m,d
.
Instead of
gmdate('yyyy-mm-dd hh:mm:ss \G\M\T', time());
You should use it like
gmdate('Y-m-d h:m:s \G\M\T', time());
Use below date function to get current time in MySQL format/(As requested on question also)
echo date("Y-m-d H:i:s", time());
You had selected the time format wrong
<?php
date_default_timezone_set('GMT');
echo date("Y-m-d,h:m:s");
?>
Source: Stackoverflow.com