destoon二次开发-签到时间函数扩展

   在api/extend.func.php文件下增加以下代码:

     

//签到时间函数
function timetoday($time = 0, $type = 6) {
	if(!$time) $time = $GLOBALS['DT_TIME'];
	$types = array('Y-m-d', 'Y', 'm-d', 'Y-m-d', 'm-d H:i', 'Y-m-d H:i', 'Y-m-d H:i:s' ,'m' ,'d' ,'M','l');
	//m月份 d日期 M月份英文缩写 l星期缩写
	if(isset($types[$type])) $type = $types[$type];
	$date = '';
	if($time > 2147212800) {		
		if(class_exists('DateTime')) {
			$D = new DateTime('@'.($time - 3600 * intval(str_replace('Etc/GMT', '', $GLOBALS['CFG']['timezone']))));
			$date = $D->format($type);
		}
	}
	return $date ? $date : date($type, $time);
}

  

原文地址:https://www.cnblogs.com/68xi/p/9434994.html