This index value in addition to the instant Noodles data record and search, also plays the role of recording date information, the amount of information is considerable.
So, how do you restore the index value to the available date information?
Date (' Z ') returns the day ordinal of a year, and the return value is an integer starting from 0 to 365. To restore these integers to date information, we only need a simple calculation. Take the 159th day of this year (2008) (actually 160 days, PHP starting from 0, 0 for the first day of the routine) as an example, calculate its date, week method as follows:
Copy CodeThe code is as follows:
$MyDate = 159; 159th Day
$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;
?>
Running the above program, the information displayed on the browser will be: June 8th, Sunday
Explanation:
I. $milliseconds is the UNIX timestamp variable, which indicates the number of milliseconds since the 159th day of 2008 from the time of the Unix era (January 1, 1700), which is an important basis for participating in the calculation of date information as a parameter in the date () function. To correctly calculate the value of $milliseconds, we first need to get the number of milliseconds experienced 2008 1st 1st, that is, Mktime (0,0,0,1,1,2008), and then add 159 days in milliseconds, that is, $MyDate * 86400, because, 86400 milliseconds per day.
Two. $msg is the date information we formatted the output, the value of this variable is obtained through the date () function, the first parameter "' F JS Y, L '" is only formatted format, can also be set to other, as needed, the second parameter is the number of milliseconds (Long integer type), The meaning is the total number of milliseconds that have elapsed from the beginning of the Unix period to a specific time.
To verify the correctness of the program, we can print the number of milliseconds experienced June 8, 2008: Mktime (0,0,0,6,8,2008), whose value will be the same as $milliseconds: 1212854400.
http://www.bkjia.com/PHPjc/322924.html www.bkjia.com true http://www.bkjia.com/PHPjc/322924.html techarticle This index value in addition to the instant Noodles data record and search, also plays the role of recording date information, the amount of information is considerable. So, how do you restore the index value to the available date information? Da ...