复制代码 代码如下:
立即学习“PHP免费学习笔记(深入)”;
echo mktime(11,25,0,9,5,2010);//和time一样的 
echo microtime(); 
echo mktime(0,0,0,1,1,1970); 
?> 
复制代码 代码如下:
立即学习“PHP免费学习笔记(深入)”;
echo date ("H i l d F" ,1283657100); 
echo gmdate("H i l d F",1283657100); 
echo strftime("%Hh%M %A %d %b" ,1283657100); 
//strftime()工作的方式和date()没有什么不同,除了特殊格式化字符的前面必须添加一个百分号%。 
echo strtotime("2010-9-5 11:25:00"); 
var_dump(getdate (time())); 
?> 
复制代码 代码如下:
立即学习“PHP免费学习笔记(深入)”;
//时间格式化 
function sgmdate($dateformat, $timestamp='', $format=0) { 
global $_SCONFIG, $_SGLOBAL; 
if(empty($timestamp)) { 
$timestamp = $_SGLOBAL['timestamp']; 
} 
$timeoffset = strlen($_SGLOBAL['member']['timeoffset'])>0?intval($_SGLOBAL['member']['timeoffset']):intval($_SCONFIG['timeoffset']); 
$result = ''; 
if($format) { 
$time = $_SGLOBAL['timestamp'] - $timestamp; 
if($time > 24*3600) { 
$result = gmdate($dateformat, $timestamp + $timeoffset * 3600); 
} elseif ($time > 3600) { 
$result = intval($time/3600).lang('hour').lang('before'); 
} elseif ($time > 60) { 
$result = intval($time/60).lang('minute').lang('before'); 
} elseif ($time > 0) { 
$result = $time.lang('second').lang('before'); 
} else { 
$result = lang('now'); 
} 
} else { 
$result = gmdate($dateformat, $timestamp + $timeoffset * 3600); 
} 
return $result; 
} 
复制代码 代码如下:
立即学习“PHP免费学习笔记(深入)”;
echo date("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998)); 
echo gmdate("M d Y H:i:s", mktime(0, 0, 0, 1, 1, 1998)); 
?> 
复制代码 代码如下:
立即学习“PHP免费学习笔记(深入)”;
//字符串时间化 
function sstrtotime($string) { 
global $_SGLOBAL, $_SCONFIG; 
$time = ''; 
if($string) { 
$time = strtotime($string); 
if(gmdate('H:i', $_SGLOBAL['timestamp'] + $_SCONFIG['timeoffset'] * 3600) != date('H:i', $_SGLOBAL['timestamp'])) { 
$time = $time - $_SCONFIG['timeoffset'] * 3600; 
} 
} 
return $time; 
} 
以上就介绍了gamma function php的日期处理函数及uchome的function_coomon中日期处理函数的研究,包括了gamma function方面的内容,希望对PHP教程有兴趣的朋友有所帮助。
                        
                        PHP怎么学习?PHP怎么入门?PHP在哪学?PHP怎么学才快?不用担心,这里为大家提供了PHP速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
                Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号