Page 1 of 1

php dst help..

Posted: Wed Mar 02, 2011 9:09 am
by only1dil
hi guys m a beginner in programing.. and i would like some help of urs in this case.. i have this date/time fuction.. in which i want to implement the DST .. i knw php takes care of dst on its own.. but wht if its not set.. or if its the older version on php..
how can i do this.. here is the code.. which i want to modify //


[[[[ $globals['pgtimezone'] = (float) (empty($user['timezone']) ? $globals['timezone'] : $user['timezone']); ]]]]



//If $format is given then TODAY feature is overided

function datify($timestamp, $today = true, $adjust = true, $format = false){

global $l, $user, $globals;

//Are we to adjust time - By default yes
if(!empty($adjust)){

$timestamp = max(0, $timestamp - ( (date('Z', time()) / 3600) - $globals['pgtimezone']) * 3600);

}

if(!empty($format)){

return date($format, $timestamp);

}

$todaytime = max(0, time() - ( (date('Z', time()) / 3600) - $globals['pgtimezone']) * 3600);

//The date thingy
if($today && date("F j, Y", $timestamp) == date("F j, Y", $todaytime)){

$time = date("g:i a", $timestamp);

return $l['today'].$time;

}else{

return date("F j, Y, g:i a", $timestamp);

}

}



i want to give user the option for dst.. if they check the box.. to enable the dst. i want to give the time out in dst format..