<?
//Display local country time, instent of displaying server time,
//If you country is Sri Lanka and web server in in USA, you can use the following script to solve your problem
//$datetime variable shuld contain the date time like date('Y-m-d H:i:s')
//$diferent variable is the diferent between server and your local country like +5.5 -6
//$mylenth from the final out put you can tell to the function how many character from $myafter sould display
//better to keep $myafter=0 and $mylenth=0 as it is
function SafGetLocalTime($datetime,$myafter=0,$mylenth=0,$diferent){ //get local time pass datetime and diferent
list($year,$month,$day,$hour,$minute,$second) = explode("-",str_replace(array(" ",":"),"-",$datetime));
$hour = ($hour+$diferent);
$datetime = mktime($hour,$minute,$second,$month,$day,$year);
if ($mylenth==0) {
$datetime = date('Y-m-d H:i:s',$datetime);
}else{
$datetime = date('Y-m-d H:i:s',$datetime);
$datetime = substr($datetime,$myafter,$mylenth);
}
return $datetime;
}
?>
Blogger templates
Blogger news
Blogroll
Archives
-
▼
2011
(212)
-
▼
October
(10)
- Getting Started with NetBeans IDE
- Display local country time, instent of displaying ...
- A simple and useful function for escaping user inp...
- Database Connection
- New cart TomatoCart
- PHP Operators Index
- Booleans data type in php
- get someone else's facebook account password
- First Post
- scalar data types in php
-
▼
October
(10)