>
Convert the time zones using PHP
Welcome, Guest

by Dinesh on Monday, 08 December 2008
Convert the time zones using PHP


Hi,

 This is php code for change time according to time zone.

<?php

//set local timezone
date_default_timezone_set("Europe/Paris");

//get server time as a unix timestamp
$unixtime = strtotime($servertime . ' EST'); //append EST to denote New York time

//convert to human readable local time
echo 'server time is '.date('r', $unixtime);

?>


Topic Normal Re: Convert the time zones using PHP
by Dinesh on 12/08/2008 18:37

Hi,

This is another way ...

<?php
echo "Original Time: ". date("h:i:s")."n";
putenv("TZ=US/Eastern");
echo "New Time: ". date("h:i:s")."n";
?>


Topic Normal Convert current servertime to GMT so the local time can be calculated
by Dinesh on 12/08/2008 18:38

Hi,

<?php

// Convert current servertime to GMT so the local time can be calculated
function fetchGMT()
{
    return mktime () + ((date('O')/100 )/-1)*60*60 ;
}
 
// What is the hour offset for OUR timezone?
// We are in GMT -6, so -6 is our offset!
$localoffset=-6 ;

$gmt=fetchGMT();  // Get GMT time
$timezoneoffset=$localoffset* 60*60; // Get offset between local and GMT
$local_time=$gmt+$timezoneoffset ; // Add offset to get local time  

?>



Blogger Image
My Blog Title

Product Engineering, software engineering company, Product Development, Product Migration, Product Re-engineering, Product Maintenance, Product Testing Commercial Application Development, Business Software development, commercial software for startups, Application Support and Maintenance, software testing Product Maintenance, Outsource product maintenance, product support and maintenance Product Migration, Product Re-engineering, product re-engineering services Product Research, Product Engineering, UI Prototyping Services Software Testing Services, Quality Assurance services, professional software testers, Load Testing, Functional Testing, Cross Platform, Browser Testing, Test Automation, Testing Tools, software quality analysis Functional Testing Services, software quality analysis, Software Testing Services, Application Testing Services, Functional Testing Types Automated Testing, Automated Testing Services, automation testing, test script development, Automation Test Tools, outsource automation testing Load Testing, Performance Testing Services, Load Testing Tools Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Benefits of IT Outsourcing, Offshore Software Development companies, offshore software development firms Outsource planning, IT outsourcing, IT development services, offshore IT companies, offshore software development Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering Offshore Software Development, Outsource software services, offshore outsourcing services, offshore software development services, IT outsourcing services, software quality assurance services, Offshore IT services, Custom Application Development Services, Offshore Product Engineering