darphas Posted August 7, 2013 Share Posted August 7, 2013 hello i have a shared hosting in hostgator so, i cant change the default server clock. then i code a script to show my local city date, but doesnt work. anyone can help me? function muestrafecha($fecha){ $mes[1]="Enero"; $mes[2]="Febrero"; $mes[3]="Marzo"; $mes[4]="Abril"; $mes[5]="Mayo"; $mes[6]="Junio"; $mes[7]="Julio"; $mes[8]="Agosto"; $mes[9]="Septiembre"; $mes[10]="Octubre"; $mes[11]="Noviembre"; $mes[12]="Diciembre"; date_default_timezone_set("America/Monterrey"); return date("j",$fecha).' '.$mes[date("n",$fecha)].' '.date("Y",$fecha).'('.date("H:i:s",$fecha).')'; return $muestra; } the date works perfect, but the time zone appears + hour Link to comment https://forums.phpfreaks.com/topic/280917-date-error-help/ Share on other sites More sharing options...
davidannis Posted August 7, 2013 Share Posted August 7, 2013 Not sure why you are off an hour. Is the clock on the server right? You can not have two return statements like that. The second will never execute. Link to comment https://forums.phpfreaks.com/topic/280917-date-error-help/#findComment-1443836 Share on other sites More sharing options...
davidannis Posted August 7, 2013 Share Posted August 7, 2013 to return multiple values use an array. Link to comment https://forums.phpfreaks.com/topic/280917-date-error-help/#findComment-1443840 Share on other sites More sharing options...
darphas Posted August 7, 2013 Author Share Posted August 7, 2013 i tried this code and workds perfect show the actual time of my city but the code what i want is flettching the time stored in a database... <?php date_default_timezone_set("America/Monterrey"); echo "La hora en Victoria es: " . date ("H:i:s",time()) . "<br />"; ?> Link to comment https://forums.phpfreaks.com/topic/280917-date-error-help/#findComment-1443854 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.