darphas Posted August 7, 2013 Share Posted August 7, 2013 (edited) 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 Edited August 7, 2013 by darphas Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
davidannis Posted August 7, 2013 Share Posted August 7, 2013 to return multiple values use an array. Quote Link to comment Share on other sites More sharing options...
Solution darphas Posted August 7, 2013 Author Solution 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 />"; ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.