Re: DateTimeZone question

2010-04-24 Thread Dave Rolsky

On Fri, 23 Apr 2010, Jeison Rengifo wrote:


i have some problems with DateTimeZone class, i have an aplication in
windows server and it works fine, but i need to migrate to linux server
(hosting), and it doesn't work and i don't know why . can you help me
please.

Thanks

add source code

Best Regards

Jeison

function of_localtimetogmt($localtime,$timezone)
{
   $timezoneinfo = new DateTimeZone($timezone);
   $arraytime = $timezoneinfo->getTransitions();
   $i = -1;
   $indice=0;
   foreach ($arraytime as $transicion)
   {
$i++;
if($transicion['ts'] - $arraytime[$i]['offset']>=$localtime)
 {
  $indice=$i-1;
  break;
 }

   }
   $newtime = $localtime-$arraytime[$indice]['offset'];
   return $newtime;
}


Uh, that looks like PHP code. You'll note that you wrote to datetime @ 
_perl_ dot org.


I'd suggest finding a list or forum that provides help with PHP.


-dave

/*
http://VegGuide.org   http://blog.urth.org
Your guide to all that's veg  House Absolute(ly Pointless)
*/


DateTimeZone question

2010-04-24 Thread Jeison Rengifo
Hi

i have some problems with DateTimeZone class, i have an aplication in
windows server and it works fine, but i need to migrate to linux server
(hosting), and it doesn't work and i don't know why . can you help me
please.

Thanks

add source code

Best Regards

Jeison

function of_localtimetogmt($localtime,$timezone)
 {
$timezoneinfo = new DateTimeZone($timezone);
$arraytime = $timezoneinfo->getTransitions();
$i = -1;
$indice=0;
foreach ($arraytime as $transicion)
{
 $i++;
 if($transicion['ts'] - $arraytime[$i]['offset']>=$localtime)
  {
   $indice=$i-1;
   break;
  }

}
$newtime = $localtime-$arraytime[$indice]['offset'];
return $newtime;
 }