//取两个日期内天数差
function SubDay($ntime,$ctime)
{
$dayst = 3600 * 24;
$cday = ceil(($ntime-$ctime)/$dayst);
return $cday;
}
//取当前时间后几天,天数增加单位为1
function AddDay($ntime,$aday)
{
$dayst = 3600 * 24;
$oktime = $ntime + ($aday * $dayst);
return $oktime;
}
//取一周内的某天是星期几
function AddSpeDay($day=0)
{
//$day = isset($day) ? intval($day) : 0;
$daynum = date(‘w’) – $day;
$oktime = time() – (3600 * 24 * $daynum);
return $oktime;
}
#附php取当前时间的方法
//取当前时间,格式为2009-10-23 14:20:35
function GetDateTimeMk($mktime)
{
return MyDate(‘Y-m-d H:i:s’,$mktime);
}
//取当前时间,格式为2009-10-23
function GetDateMk($mktime)
{
return MyDate(“Y-m-d”,$mktime);
}
?>
|