Display date and time for local time zone
Hello Reader
I am fashionable in this article globe.But i? have just start manuscript? articles about my favorite field programming.
my favorite language is php. and i have amplified many simple as well for complex projects in php.
So
I am? sharing some of my experience with you almost time zone.
i understand my English is not so agreeable . merely i forever attempt to amend it.
So come in the point.
If your server is in UK and your site is visiting from India . you want my site show appointment & period of ( Eg, productions,simple site time,articles submitted appointment and time? ) in local time region. without amending anyone entity in? the data pedestal.
you can simple obtain along this feature.
Insert ask in your data base
CREATE TABLE IF NOT EXISTS `pcp_timezone1` (
`timezid` int(11) NOT NULL auto_increment,
`tz` varchar(250) NOT NULL default '',
`gmt` text NOT NULL,
PRIMARY KEY? (`timezid`)
) ENGINE=InnoDB? DEFAULT CHARSET=latin1 AUTO_INCREMENT=31 ;
--
-- Dumping data for table `pcp_timezone1`
--
INSERT INTO `pcp_timezone1` (`timezid`, `tz`, `gmt`) VALUES
(1, 'Pacific/Kwajalein', '(GMT -12:00) Eniwetok, Kwajalein'),
(2, 'Pacific/Samoa', '(GMT -11:00) Midway Island, Samoa'),
(3, 'Pacific/Honolulu', '(GMT -10:00) Hawaii'),
(4, 'America/Anchorage', '(GMT -9:00) Alaska'),
(5, 'America/Los_Angeles', '(GMT -8:00) Pacific Time (US & Canada) Los Angeles, Seattle'),
(6, 'America/Denver', '(GMT -7:00) Mountain Time (US & Canada) Denver'),
(7, 'America/Chicago', '(GMT -6:00) Central Time (US & Canada), Chicago, Mexico City'),
(8, 'America/New_York', '(GMT -5:00) Eastern Time (US & Canada), New York, Bogota, Lima'),
(9, 'Atlantic/Bermuda', '(GMT -4:00) Atlantic Time (Canada), Caracas, La Paz'),
(10, 'Canada/Newfoundland',
tods shoes sale, '(GMT -3:30) Newfoundland'),
(11, 'Brazil/East', '(GMT -3:00) Brazil, Buenos Aires, Georgetown'),
(12, 'Atlantic/Azores', '(GMT -2:00) Mid-Atlantic'),
(13, 'Atlantic/Cape_Verde', '(GMT -1:00 hour) Azores, Cape Verde Islands'),
(14, 'Europe/London', '(GMT) Western Europe Time, London, Lisbon, Casablanca'),
(15, 'Europe/Brussels',
tory burch miller, '(GMT +1:00 hour) Brussels, Copenhagen, Madrid, Paris'),
(16, 'Europe/Helsinki', '(GMT +2:00) Kaliningrad, South Africa'),
(17, 'Asia/Baghdad', '(GMT +3:00) Baghdad, Riyadh, Moscow, St. Petersburg'),
(18, 'Asia/Tehran', '(GMT +3:30) Tehran'),
(19, 'Asia/Baku', '(GMT +4:00) Abu Dhabi, Muscat, Baku, Tbilisi'),
ed hardy men shirts,
(20, 'Asia/Kabul', '(GMT +4:30) Kabul'),
jp tods,
(21, 'Asia/Karachi', '(GMT +5:00) Ekaterinburg, Islamabad, Karachi, Tashkent'),
(22,
ed hardy clothing uk, 'Asia/Calcutta', '(GMT +5:30) Bombay, Calcutta, Madras, New Delhi'),
(23, 'Asia/Dhaka', '(GMT +6:00) Almaty, Dhaka, Colombo'),
(24, 'Asia/Bangkok', '(GMT +7:00) Bangkok, Hanoi, Jakarta'),
(25,
ed hardy wholesale, 'Asia/Hong_Kong', '(GMT +8:00) Beijing, Perth, Singapore, Hong Kong'),
(26, 'Asia/Tokyo', '(GMT +9:00) Tokyo, Seoul, Osaka, Sapporo, Yakutsk'),
(27, 'Australia/Adelaide', '(GMT +9:30) Adelaide, Darwin'),
(28, 'Pacific/Guam', '(GMT +10:00) Eastern Australia, Guam, Vladivostok'),
(29, 'Asia/Magadan', '(GMT +11:00) Magadan, Solomon Islands, New Caledonia'),
(30, 'Pacific/Fiji', '(GMT +12:00) Auckland, Wellington, Fiji, Kamchatka');
and
$date='2009-06-29 11:02' // current data and time of server
$timezone='Asia/Calcutta'; // you want indian time zone
$format='F d,Y H:i a'? //? give format of date and time in which format you want time and date
we give data base query if you want time zone variables ($timezone)? comes from data base
convert_tz($date,$timezone,$format);
This is chief function this will return? local time zone
function convert_tz ($date_str, $tz, $date_format = "r")
$time = strtotime($date_str);
$tz_bak = getenv("TZ");
putenv("TZ=$tz");
$ret = date($date_format, $time);
putenv("TZ" . ($tz_bak ? "=$tz_bak" : ""));
return $ret;
If? my artice namely obliging for you amuse give me response aboard
sana.u@rediffmail.com.
if any problem apt use please contact me at
sana.u@rediffmail.com
相关的主题文章:
hogan stores Christianity in the Present_3267
Ethnic Groups in South East Asia_4609