Hi Everybody ,i have a problem with DateTime class,I am using DateTime class in my program it works fine in php 5.2.6 .but the version in my server is php 5.1.6 so is there any class to replace the same functionality.please check the code below and if u find any solution for this please reply me.
CODE:
--------------------------------------------------------------------------------------------------------
function trackCountry($ip,$date)
{
include("geoip.inc");
include("geoipcity.inc");
include("geoipregionvars.php");
//function for opening the database
$gi = geoip_open("/opt/lampp/htdocs/theopencamp/Ver2/theopencamp2/include/GeoLiteCity.dat", GEOIP_STANDARD);
//function to retrieve the information of the particular ip and casting it to array
$rsGeoData =(array) geoip_record_by_addr($gi,$ip);
geoip_close($gi);
if(is_array($rsGeoData))
{
$countrycode=$rsGeoData['country_code'];
$region=$rsGeoData['region'];
}
//Converting of localtime to utc
require("timezone.php");
$tz= get_time_zone($countrycode,$region);
$timestamp = 1240349566;
// set this to the time zone provided by the user
// create the DateTimeZone object for later
$dtzone = new DateTimeZone($tz);
// first convert the timestamp into a string representing the local time
$time = date('r', $timestamp);
// now create the DateTime object for this time
$dtime = new DateTime($date);
// convert this to the user's timezone using the DateTimeZone object
$dtime->setTimeZone($dtzone);
// print the time using your preferred format
$time = $dtime->format('Y-m-d-H-i-s');
return $time;
}
?>