Strtotime at this time of the Unix timestamp, the need for a friend can be a simple reference, the middle also said the GETDATE function, then can be output seconds and minutes.
The code is as follows |
Copy Code |
First assume a time $dt = "2010-09-06 11:19:56"; echo "Time:". $dt. " "; Format this time as a Unix timestamp $tm = Strtotime ($DT); echo "Unix timestamp at this time:" $tm. " "; ?> Instance return timestamp with Mktime () $tm = Mktime (23,56,59,12,20,1999); echo "December 20, 1999 23:56 59 seconds Unix Timestamp:". $tm; return timestamp with Strtotime () $tm 2= strtotime ("1999-12-20 23:56:59"); echo " Time stamp obtained with Strtotime at the same time: ". $tm 2; ?> Two Set a time (such as time () available with current $tm = Strtotime ("2006-09-09 10:30:40"); echo "Initialization set time: 2006-09-09-10:30:40 "; Test the output effect with a different format string echo Date ("Y-m-d h:i:s A", $tm). " "; echo Date ("Y-m-d h:i:s a", $tm). " "; echo Date ("Y year m month D Day [l] H point I min s S", $tm). " "; echo Date ("F,d,y l", $tm). " "; echo Date ("Y-m-d h:i:s", $tm). " "; echo Date ("Y-m-d h:i:s", $tm). " "; echo Date ("Time zone: T, Difference from GMT: O Hours", $tm). " "; Output details ?> Get more information about this time $arr = getdate ($TM); Output details echo "seconds:". $arr ["Seconds"]. " "; echo "Points:". $arr ["Minutes"]. " "; echo "When:". $arr ["hours"]. " "; echo "Day:". $arr ["Mday"]. " "; echo "Month:". $arr ["Mon"]. " /". $arr [" Month "]." "; echo "Years:". $arr ["Year"]. " "; echo "Week:". $arr ["Wday"]. " /". $arr [" Weekday "]." "; echo "The date is the first of the year". $arr ["Yday"]. " Days "; ?> |
http://www.bkjia.com/PHPjc/631321.html www.bkjia.com true http://www.bkjia.com/PHPjc/631321.html techarticle Strtotime at this time of the Unix timestamp, the need for a friend can be a simple reference, the middle also said the GETDATE function, then can be output seconds and minutes. Code to copy the code below? PHP//First ...