change timezones in php : PHP
This is a discussion on change timezones in php within the PHP forums in Programming Languages category; Hi, PHP scripting language have an built in function to change between the timezones , you will need the PEAR package . In the following example show you how to convert from GMT system format to IST Format . Code: <?php // include class include ("Date.php"); // initialize object $d = new Date("2008-10-03 16:23:48"); // set server time zone $d->setTZByID("GMT"); // print server time echo "Local time is " . $d->format("%A, %d %B %Y %T") . "\n"; // convert to IST $d->convertTZByID("PST"); // output converted date/time echo "Destination time is " . $d->format("%A, %d %B %Y %T"); ?>...
![]() |
| | LinkBack | Thread Tools |
|
#1
| |||
| |||
| PHP scripting language have an built in function to change between the timezones , you will need the PEAR package . In the following example show you how to convert from GMT system format to IST Format . Code: <?php
// include class
include ("Date.php");
// initialize object
$d = new Date("2008-10-03 16:23:48");
// set server time zone
$d->setTZByID("GMT");
// print server time
echo "Local time is " . $d->format("%A, %d %B %Y %T") . "\n";
// convert to IST
$d->convertTZByID("PST");
// output converted date/time
echo "Destination time is " . $d->format("%A, %d %B %Y %T");
?>
|
![]() |
« Previous Thread
|
Next Thread »
| Thread Tools | |
| |
| ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Using timezones | usenet | PHP | 2 | 05-04-2007 09:16 AM |
| available timezones | usenet | PHP | 0 | 07-26-2004 12:34 AM |
| timezones | usenet | PHP | 6 | 05-01-2001 09:11 AM |
| Re: [PHP] timezones | usenet | PHP | 0 | 04-30-2001 02:12 PM |
| Timezones | usenet | Weblogic | 5 | 07-26-2000 08:35 AM |
All times are GMT -5. The time now is 12:49 AM.



