亚洲最大看欧美片,亚洲图揄拍自拍另类图片,欧美精品v国产精品v呦,日本在线精品视频免费

  • 站長(zhǎng)資訊網(wǎng)
    最全最豐富的資訊網(wǎng)站

    php如何把時(shí)間轉(zhuǎn)為時(shí)間戳

    在php中可以通過strtotime函數(shù)把時(shí)間轉(zhuǎn)為時(shí)間戳,其語(yǔ)法是“strtotime(time,now);”,參數(shù)time表示日期時(shí)間字符串,而參數(shù)now是用來計(jì)算返回值的時(shí)間戳。

    php如何把時(shí)間轉(zhuǎn)為時(shí)間戳

    推薦:《PHP視頻教程》

    strtotime() 函數(shù)將任何英文文本的日期或時(shí)間描述解析為 Unix 時(shí)間戳(自 January 1 1970 00:00:00 GMT 起的秒數(shù))。

    注意:如果年份表示使用兩位數(shù)格式,則值 0-69 會(huì)映射為 2000-2069,值 70-100 會(huì)映射為 1970-2000。

    注意:請(qǐng)注意 m/d/y 或 d-m-y 格式的日期,如果分隔符是斜線(/),則使用美洲的 m/d/y 格式。如果分隔符是橫杠(-)或者點(diǎn)(.),則使用歐洲的 d-m-y 格式。為了避免潛在的錯(cuò)誤,您應(yīng)該盡可能使用 YYYY-MM-DD 格式或者使用 date_create_from_format() 函數(shù)。

    語(yǔ)法

    strtotime(time,now);

    參數(shù)

    time 必需。規(guī)定日期/時(shí)間字符串。

    now 可選。規(guī)定用來計(jì)算返回值的時(shí)間戳。如果省略該參數(shù),則使用當(dāng)前時(shí)間。

    實(shí)例:

    <?php echo(strtotime("now") . "<br>"); echo(strtotime("5 September 2016") . "<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")); ?>

    運(yùn)行結(jié)果是:

    1604901378 1473004800 1604919378 1605506178 1605790583 1605456000 1604764800

    贊(0)
    分享到: 更多 (0)
    網(wǎng)站地圖   滬ICP備18035694號(hào)-2    滬公網(wǎng)安備31011702889846號(hào)