Jump to content

Date error HELP


darphas
Go to solution Solved by darphas,

Recommended Posts

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 by darphas
Link to comment
Share on other sites

  • Solution

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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.