I have a database with date field is this format "2010.06.11. | 10:26 13"
What is need is a php array that would hold all the different dates, .ie
array[0] = "2010.06.09."
array[1] = "2010.06.10."
array[2] = "2010.06.11."
Currently I am doing it by selecting the whole table, then looping through the result and adding the date substr to an array if it is not already there.
But maybe there is a faster way? Thanks.
您可以直接从数据库中仅选择不同的日期:
SELECT DISTINCT SUBSTRING(date, 1, 11) AS date_string FROM table
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.