...

View Full Version : TZ varies from actual local time



swatisonee
08-12-2008, 05:35 AM
Strange issue .

I'm using the foll. code but the time it indicates is about 7-8 mins faster than the current local standard time. Any idea how I could rectify this ?





$date = putenv('TZ=Asia/Calcutta');
// $date = putenv('TZ=Asia/Katmandu'); // tried this option too

mktime(0,0,0,1,1,1970) ;
echo '<p align="center"> ';

// displays 07-08-2008 14:02:44 when the actual local time is 07-08-2008 13:55:44

elementis0
08-12-2008, 08:43 AM
Well what if you tried something like this with your code:



<?php
$date = putenv('TZ=Asia/Calcutta'); //set the time
$date = date("H:i:s", mktime(date("H"), date("i")-7, date("s"), date("j"), date("m"), date("y")));
//formats the time, but subtracts 7 from the mktime in minutes
//so the time stays correct
echo $date;
?>

if this code still does not display the correct time just add or subtracts to the minutes/hours

I hope this helps!

NancyJ
08-12-2008, 02:22 PM
Or you could fix the clock on your server (or your clock, depending on which is wrong)



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum