Home >Backend Development >PHP Tutorial >wwe October 25, 2013 Code to calculate the date year, month and day based on the day of the year in php
In addition to recording and searching instant noodles data, this index value also plays the role of recording date information, and the amount of information is considerable.
So, how to restore the index value to available date information?
date('z') returns the day of the year, and the return value is an integer starting from 0 to 365. To restore these integers to date information, we just need a simple calculation. Taking the 159th day of this year (2008) (actually 160 days, starting from 0 in PHP, 0 corresponds to the regular first day) as an example, the method for calculating its date and week is as follows:
Copy code The code is as follows:
$MyDate=159; //Day 159
$milliseconds = mktime(0,0,0,1,1,2008) + $MyDate * 86400; //Get UNIX time Stamp
$msg = date('F jS Y , l',$milliseconds); //Format date output
echo $msg;
?>
The above introduces the code in PHP to calculate the date year, month and day based on the day of the year in wwe October 25, 2013, including the content of wwe October 25, 2013. I hope it will be helpful to friends who are interested in PHP tutorials. .