1.question: The default date Korean bundle produces time and time difference eight hours, time zone default setting is not Beijing time
Date_default_timezone_set (' PRC '); China time Zone
$test = Date ("Y-m-d h:i:s", Time ());
The difference between timestamp and datetime in a 2.mysql time field
3. Time format
Function Description Strtotime: Time conversion to timestamp detail is
Echo strtotime (Date (' y-m-d ')); rs-"1429372800
Queries for 4.MySQL databases
The current time $test = Date ("y-m-d h:i:s", Times ());
Day Query $start = date ("Y-m-d", Time ()). ' 00:00:00 ';//start of the day
$end = Date ("Y-m-d", Time ()). ' 23:59:59 ';//The End of the day
Month to current time query
$start =strtotime (Date (' y-m-01 00:00:00 '));
$end = strtotime (Date (' y-m-d h:i:s '));
$data [' CID ']= $cid;
$data [' createtime '] = Array (' Between ', Array ($start, $end));
An entire month of inquiries
$test = Date ("Y-m-01 h:i:s", Time ());//The first day of the month
$test = Date ("Y-m-t 23:59:59", Time ());//Last Day of the month
Forward backwards * * * Month * * Query
$test = 6;
$PD =date (' y-m-d h:i:s ', Strtotime ('-'. $test. ' Day '));
$PD 1=date (' y-m-d h:i:s ', Strtotime (' 2 Day '));
echo "Tomorrow:", Date (' y-m-d h:i:s ', Strtotime ('-'. $test. ' Day '));
Query-thinkphp of Time function