return,date,function,static,dateArr
后端开发-php教程
php 时间日期工具类 三级话费分销app源码,vscode背景透明度,ubuntu lyx配置,配置tomcat问题总结,学qt爬虫,php网站多少钱,seo跨境电商平台价格,最新仿uehtml网站源码,discuz 修改门户模板lzw
1582), century not-divisible by 400 is not leap else if ($year > 1582 && $year % 100 == 0 ) return false; return true; } /** * Fix 2-digit years. Works for any century. * Assumes that if 2-digit is more than 30 years in future, then previous century. * @param integer $y year * @return integer change two digit year into multiple digits */ protected static function digitCheck($y) { if ($y 50) { $c1 = $century + 1; $c0 = $century; } else { $c1 = $century; $c0 = $century - 1; } $c1 *= 100; // if 2-digit year is less than 30 years in future, set it to this century // otherwise if more than 30 years in future, then we set 2-digit year to the prev century. if (($y + $c1) < $yr+30) $y = $y + $c1; else $y = $y + $c0*100; } return $y; } /** * Returns 4-digit representation of the year. * @param integer $y year * @return integer 4-digit representation of the year */ public static function get4DigitYear($y) { return self::digitCheck($y); } /** * Checks to see if the year, month, day are valid combination. * @param integer $y year * @param integer $m month * @param integer $d day * @return boolean true if valid date, semantic check only. */ public static function isValidDate($y,$m,$d) { return checkdate($m, $d, $y); } public static function checkDate($date, $separator = "-") { //检查日期是否合法日期 $dateArr = explode ($separator, $date); if (is_numeric ( $dateArr [0] ) && is_numeric ( $dateArr [1] ) && is_numeric ( $dateArr [2] )) { return checkdate ( $dateArr [1], $dateArr [2], $dateArr [0] ); } return false; } /** * Checks to see if the hour, minute and second are valid. * @param integer $h hour * @param integer $m minute * @param integer $s second * @param boolean $hs24 whether the hours should be 0 through 23 (default) or 1 through 12. * @return boolean true if valid date, semantic check only. * @since 1.0.5 */ public static function isValidTime($h,$m,$s,$hs24=true) { if($hs24 && ($h 23) || !$hs24 && ($h 12)) return false; if($m > 59 || $m 59 || $s = 0 && $timeArr [0] = 0 && $timeArr [1] = 0 && $timeArr [2] public static function getWeekDay($date, $separator = "-") { //计算出给出的日期是星期几 $dateArr = explode ($separator, $date); return date ( "w", mktime ( 0, 0, 0, $dateArr [1], $dateArr [2], $dateArr [0] ) ); } public static 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 ); } public static 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 public static 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 public static 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 public static 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 public static 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; }}?>
?
asp 点播 源码,vscode 主题创建,ubuntu getflv,tomcat本地很慢,sqlite数据库批量,wordpress赞踩插件,乾坤微前端框架使用方法,侏罗纪世界2中的爬虫,php 截取 url,苏州昆山seo费用,蓝色脚手架织梦企业网站模板,好看的网页导航代码,html网页页面模板代码下载lzw