PHP Classes

Timezone Converter: Converts dates and times between time zones

Recommend this page to a friend!
  Info   View files Example   View files View files (4)   DownloadInstall with Composer Download .zip   Reputation   Support forum (3)   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 52%Total: 998 This week: 1All time: 3,652 This week: 560Up
Version Licenses PHP version Categories
timezoneconverterapi 1.0GNU General Publi...4.0Localization, Time and Date
Description 

Author

This class can be used to convert dates and times between time zones.

It takes a given date and time in a given time zone and can convert the data and time to another of about 200 supported time zones.

Picture of Utsav Handa
Name: Utsav Handa <contact>
Classes: 3 packages by
Country: India India
Age: 40
All time rank: 54434 in India India
Week rank: 411 Up26 in India India Up
Innovation award
Innovation award
Nominee: 1x

Example

<?php

/**
This class implements Timezone datetime conversion functionality.

There is a simple usage for converting specified datetime into specified timezone.

This class supports about 200 timezone conversion including some local timezone.
This class uses generic PHP functions for conversion.
**/


print "Simple Example ::";
/***************** Simple Example ********************/
/** convert local datetime to IST (Indian Standard Time) */
require_once('class-timezone-conversion.php'); /** Include class */
$tz = new TimezoneConversion(); /** Create TimezoneConversion Object */
$tz->setProperty('DateTime', 'now'); /** Set local 'DateTime' to convert */
$tz->setProperty('Timezone', 'IST'); /** Get IST */
print "\n IST ::" . $tz->convertDateTime();


print
"\n\n Advanced Example ::";
/***************** Advanced Example ********************/
/** Convert local 'DateTime' to ISt (Indian Standard Time) and then convert IST to PDT (Pacific Daylight Time) */
$tz = new TimezoneConversion(); /** Create TimezoneConversion Object */
$tz->setProperty('DateTime', 'now'); /** Set local 'DateTime' to convert */
$tz->setProperty('Timezone', 'IST'); /** Get IST */
$ist_datetime = $tz->convertDateTime();
print
"\n IST ::" . $ist_datetime;
/** IST => PDT */
$tz->setProperty('DateTime', $ist_datetime); /** Set IST to convert to PDT */
$tz->setProperty('Timezone', 'PDT'); /** Get PDT */
print "\n PDT ::" . $tz->convertDateTime()."\n";


?>


Details

/* -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= -= imezone Conversion -= -= File: class-timezone-conversion.php -= -= Created by: Utsav Handa -= -= Email: handautsav [at] hotmail dot com -= -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= */ This class implements Timezone datetime conversion functionality. There is a simple usage for converting specified datetime into specified timezone. This class supports about 200 timezone conversion including some local timezone. This class uses generic PHP functions for conversion. Description:: --------------- This class provides a simple method to convert between time zones. It simply uses the built-in PHP function(s) which is available in PHP 4.x and higher. This class supports about 200 timezone conversion including some local timezone around the World. The TimezoneConversion rules on which this converter is based are to provide you with the most accurate time converter utility on the Net! Example : /** require_once('class-timezone-conversion.php'); $tz = new TimezoneConversion(); print "\n Local:: " .$tz->getLocalDateTime(); print "\n GMT ::" .$tz->convertDateTime(); $tz->setProperty('Timezone', 'IST'); print "\n IST ::" .$tz->convertDateTime(); **/ This class it's intended only for experimental/learning purposes. This class is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Utsav Handa - handautsav [at] hotmail dot com

  Files folder image Files  
File Role Description
Plain text file class-timezone-conversion-php4.php Class This library provides generic timezone conversion functionlity (for PHP < 5.0)
Plain text file class-timezone-conversion.php Class This library provides generic timezone conversion functionlity in an uniform way.
Accessible without login Plain text file example.php Example Example Script
Accessible without login Plain text file ReadME.txt Doc. ReadMe Manual

 Version Control Unique User Downloads Download Rankings  
 0%
Total:998
This week:1
All time:3,652
This week:560Up
User Ratings User Comments (1)
 All time
Utility:62%StarStarStarStar
Consistency:75%StarStarStarStar
Documentation:68%StarStarStarStar
Examples:68%StarStarStarStar
Tests:-
Videos:-
Overall:52%StarStarStar
Rank:2321