2021
01-22
01-22
PHP获取当前时间的5种实现方式
在日期和时间函数中,UNIX时间戳的获取非常重要,时间戳是一个字符序列,是指格林尼治时间1970年01月01日00时00分00秒(北京时间1970年01月01日08时00分00秒)起至现在的总毫秒数。下面介绍几个获取当前时间的函数。gmmktime()gmmktime()函数可取得GMT日期的UNIX时间戳。语法如下:intgmmktime([int$hour[,int$minute[,int$second[,int$month[,int$day[,int$year[,int$is_dst...
继续阅读 >
在methods中创建方法showtime,传入要跟当前时间要对比的时间showtime(time){letdate=typeoftime==="number"?newDate(time):newDate((time||"").replace(/-/g,"/"));letdiff=(newDate().getTime()-date.getTime())/1000;letdayDiff=Math.floor(diff/86400);letisValidDate=Object.prototype.toString.call(date)==="[objectDate]"&&!isNaN(date.getTime(...