php时间操作

    技术2022-05-11  88

    函数: The strtotime() 功能:将任何英文文本的时间转换为UNIX时间戳(从1970年1月1日(GMT)起经过的秒数),进行一些代数运算

    Parameter参数Description描述timeRequired. Specifies the time string to parse必要参数。指定需要被解析的时间字符串。nowOptional. Specifies the timestamp used to calculate the returned value. If this parameter is omitted, current time is used可选参数。指定用来计算返回值的时间戳。如果这个参数被忽略,那么将默认使用当前时间

    <? php echo ( strtotime ( " now " .   " <br /> " ); echo ( strtotime ( " 3 October 2005 " .   " <br /> " ); echo ( strtotime ( " +5 hours " .   " <br /> " ); echo ( strtotime ( " +1 week " .   " <br /> " ); echo ( strtotime ( " +1 week 3 days 7 hours 5 seconds " .   " <br /> " ); echo ( strtotime ( " next Monday " .   " <br /> " ); echo ( strtotime ( " last Sunday " )); ?>   输出: 1138614504 1128290400 1138632504 1139219304 1139503709 1139180400 1138489200

    最新回复(0)