Obtain bitsCN.com from the mysql timestamp in the specified format (Y-m-d ).
In the previous collection script, the collection time is taken out in the form of unix Timestamps. when writing SQL statements, you need to query the corresponding records by time, the $ time passed in on the page is a string like '2017-01'. how can I write an SQL statement?
$ SQL. = 'and FROM_UNIXTIME (time, "% Y-% m") = /''. $ time. '/''; in this way, records corresponding to $ time in the database can be retrieved.
Some may say why don't we directly strtotime () $ time and then match the database data? the situation is as follows: $ time, for example, '2017-01 ', however, the time in the database is accurate to the day, so that the two do not match, the subsequent processing is also more complex, it is much easier to directly use mysql functions ..
BitsCN.com