数组仅按日期和月份排序(忽略年份) [英] Array sort by date and month only (ignore year)

查看:69
本文介绍了数组仅按日期和月份排序(忽略年份)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有以下节日数组:

id = 1, Start_date = 2011-11-01 , End_date = 2016-12-31

[[1, 2011-11-01 , 2016-12-31],
[2, 2011-11-28 , 2016-12-31],
[3, 2011-10-01 , 2015-12-31],
[4, 2011-11-28 , 2021-12-31],
[5, 2010-11-15 , 2016-12-31],
[6, 2011-07-01 , 2017-12-31],
[7, 2012-02-01 , 2013-02-19],
[8, 2011-03-21 , 2015-04-30],
[9, 2012-03-01 , 2016-03-20]]

我需要按从当前日期开始的 start_date 进行排序,但是在此忽略年份(仅使用月份和日期).

I need to sort this by start_date start from current date but ignore year here (use only month and day).

实际上,这是节日的开始日期和结束日期.我需要先显示正在运行的节日(顺序为:start_date),然后再显示即将到来的节日(顺序为:start_date).

Actually these are festival's start dates and end dates. I need to show running festivals first(order by: start_date) then upcoming festivals(order by: start_date separately).

例如:

festival A: start_date: 15-may  - end_date: 15-june  
festival B: start_date: 01-june - end_date: 20-june
festival C: start_date: 01-oct  - end_date: 30-oct

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆