Home > Backend Development > PHP Tutorial > Mysql php can print the date of the order, but how to display it by year?

Mysql php can print the date of the order, but how to display it by year?

WBOY
Release: 2016-10-11 14:23:36
Original
1031 people have browsed it

Thanks to the SF experts for their guidance https://segmentfault.com/q/10...

My order system can already print the date when the order is placed. For example,
2016-06-06 2016-06-05 2016-06-03 2016-06-01

This format
can also display the total number of transactions for the day

<code>$DONE_ORDER = mysql_query("SELECT distinct buytime FROM `buy` 
"); 
while($DONE_ORDER_ROW = mysql_fetch_array($DONE_ORDER))
{

?>

<button type="button" onClick="location.href='';"><? echo date("Y-m-d",$DONE_ORDER_ROW['buytime']);?></button>

<? }?></code>
Copy after login
Copy after login

But how can I display it by year?
For example

2016

2016-06-06 2016-06-05 2016-06-03 2016-06-01

2015

2015-04-06 2015-05-05 2015-03-03 2015-07-01

Reply content:

Thanks to the SF experts for their guidance https://segmentfault.com/q/10...

My order system can already print the date when the order is placed. For example,
2016-06-06 2016-06-05 2016-06-03 2016-06-01

This format
can also display the total number of transactions for the day

<code>$DONE_ORDER = mysql_query("SELECT distinct buytime FROM `buy` 
"); 
while($DONE_ORDER_ROW = mysql_fetch_array($DONE_ORDER))
{

?>

<button type="button" onClick="location.href='';"><? echo date("Y-m-d",$DONE_ORDER_ROW['buytime']);?></button>

<? }?></code>
Copy after login
Copy after login

But how can I display it by year?
For example

2016

2016-06-06 2016-06-05 2016-06-03 2016-06-01

2015

2015-04-06 2015-05-05 2015-03-03 2015-07-01

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template