本文實(shí)例講述了php數(shù)值轉(zhuǎn)換時(shí)間及時(shí)間轉(zhuǎn)換數(shù)值用法。分享給大家供大家參考,具體如下:
echo $startime=strtotime(date("Y-m-d",time()));//當(dāng)天0點(diǎn)時(shí)間戳echo "<br/>";echo $endttime=strtotime(date("Y-m-d",time()).' 23:59:59');//當(dāng)天23:59:59的INT類(lèi)型時(shí)間戳echo "<br/>";//把數(shù)值型轉(zhuǎn)成時(shí)間字符型$dotime="1357985479";echo date("Y-m-d H:i:s",$dotime);//把數(shù)字型時(shí)間按格式轉(zhuǎn)換成時(shí)間格echo "<br/>";//輸出當(dāng)前時(shí)間字符串型echo strtotime(date('Y-m-d H:i:s',time()));echo "<br/>";//把數(shù)值型轉(zhuǎn)成字符串型echo date('Y-m-d H:i:s','1357985479');echo "<br/>";//把字符串型轉(zhuǎn)成數(shù)值型echo strtotime('Y-m-d H:i:s');//echo "<br/>";//最近七天echo strtotime("-7 days")運(yùn)行結(jié)果如下:
149506560014951519992013-01-12 10:11:1914950734702013-01-12 10:11:191494468670
希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。
新聞熱點(diǎn)
疑難解答
圖片精選