= 0 && $timearr [0] = 0 && $timearr [1] = 0 && $timearr [2] $v ) { $v = ereg_replace ( ^0{1,}, '', trim ( $v ) ); if ($v == '') { $dt [$k] = 0; } } $mt = @gmmktime ( $dt [3], $dt [4], $dt [5], $dt [1], $dt [2], $dt [0] ) - 3600 * $cfg_cli_time; if (! empty ( $mt )) { return $mt; } else { return time (); } } function mydate($format = 'y-m-d h:i:s', $timest = 0) { //返回格林威治标准时间 //global $cfg_cli_time='+8'; global $cfg_cli_time; $addtime = $cfg_cli_time * 3600; if (empty ( $format )) { $format = 'y-m-d h:i:s'; } return gmdate ( $format, $timest + $addtime ); } function floortime($seconds) { //让日期显示为:xx天xx年以前 $times = ''; $days = floor ( ($seconds / 86400) % 30 ); $hours = floor ( ($seconds / 3600) % 24 ); $minutes = floor ( ($seconds / 60) % 60 ); $seconds = floor ( $seconds % 60 ); if ($seconds >= 1) $times .= $seconds . '秒'; if ($minutes >= 1) $times = $minutes . '分钟 ' . $times; if ($hours >= 1) $times = $hours . '小时 ' . $times; if ($days >= 1) $times = $days . '天'; if ($days > 30) return false; $times .= '前'; return str_replace ( , '', $times ); } function transdatetochs($date) { if (empty ( $date )) return '今日'; $y = _date ( 'y', strtotime ( $date ) ); $m = _date ( 'm', strtotime ( $date ) ); $d = _date ( 'd', strtotime ( $date ) ); return $y . '年' . $m . '月' . $d . '日'; } // 08/31/2004 => 2004-08-31 function transdateui($datestr, $type = 'y-m-d') { if ($datestr == null) return null; $target = $datestr; $arr_date = preg_split ( /\//, $target ); $monthstr = $arr_date [0]; $daystr = $arr_date [1]; $yearstr = $arr_date [2]; $result = date ( $type, mktime ( 0, 0, 0, $monthstr, $daystr, $yearstr ) ); return $result; } // 12/20/2004 10:55 am => 2004-12-20 10:55:00 function transdatetimeui($datestr, $type = 'y-m-d h:i:s') { if ($datestr == null) return null; $target = $datestr; $arr_date = preg_split ( /\/|\s|:/, $target ); $monthstr = $arr_date [0]; $daystr = $arr_date [1]; $yearstr = $arr_date [2]; $hourstr = $arr_date [3]; $minutesstr = $arr_date [4]; $result = date ( $type, mktime ( $hourstr, $minutesstr, 0, $monthstr, $daystr, $yearstr ) ); return $result; } // 2004-08-31 => 08/31/2004 function transdatedb($datestr, $type = 'm/d/y') { if ($datestr == null) return null; if ($datestr == '0000-00-00') return null; $target = $datestr; $arr_date = preg_split ( /-/, $target ); $monthstr = $arr_date [1]; $daystr = $arr_date [2]; $yearstr = $arr_date [0]; $result = date ( $type, mktime ( 0, 0, 0, $monthstr, $daystr, $yearstr ) ); return $result; } // 2004-08-31 10:55:00 => 12/20/2004 10:55 am function transdatetimedb($datestr, $type = 'm/d/y h:i a') { if ($datestr == null) return null; $target = $datestr; $arr_date = preg_split ( /-|\s|:/, $target ); $monthstr = $arr_date [1]; $daystr = $arr_date [2]; $yearstr = $arr_date [0]; $hourstr = $arr_date [3]; $minutesstr = $arr_date [4]; $secondstr = $arr_date [5]; $result = date ( $type, mktime ( $hourstr, $minutesstr, $secondstr, $monthstr, $daystr, $yearstr ) ); return $result; }}?>
?