Home  >  Article  >  Backend Development  >  Convert year, month and day data into three-level linkage array

Convert year, month and day data into three-level linkage array

WBOY
WBOYOriginal
2016-09-21 14:12:581195browse

The structure of each data is as follows:

<code>{
    id: 2,
    year: "2016",
    month: "09",
    day: "19",
    time_name: "下午班",
    time_range: "14:00-17:00"
},</code>

It needs to be converted into the following linkage effect based on the year, month and day data inside. I haven’t thought of a better loop to make them into a data structure like province and city linkage, because after all, there are 3 dimensions. Is there any better solution?

Convert year, month and day data into three-level linkage array

Reply content:

The structure of each data is as follows:

<code>{
    id: 2,
    year: "2016",
    month: "09",
    day: "19",
    time_name: "下午班",
    time_range: "14:00-17:00"
},</code>

It needs to be converted into the following linkage effect based on the year, month and day data inside. I haven’t thought of a better loop to make them into a data structure like province and city linkage, because after all, there are 3 dimensions. Is there any better solution?

Convert year, month and day data into three-level linkage array

It is too troublesome to use code to filter items one by one. It is recommended to use web sql. You can search for related articles
or you can read this html5 local storage

Statement:
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