<?
//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)
-
▼
August
(17)
- create table in php with mysql
- Upload the image to server
- For getting the files and folders in a directory
- How fast can you type?
- user model<!--?phpsession_start();define("DB_SERVE...
- Register Globals
- Assignment #8 Final Project
- global variable in php
- Display local country time, instent of displaying ...
- REST Architecture with PHP
- PHP to MySQL Date Format
- How to enable showing queries in Code Igniter prof...
- Vertrigo server installation
- Enable Windows Authentication in a PHP website
- Tipo de datos Booleanos en Php
- What is PHP?
- Introduction
-
▼
August
(17)