Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Recommended Working Hours JSON Format

Tags:

json

format

I'm wondering what the best way would be to express an agency's working hours in JSON format. Let's say the agency works 5 days a week (not necessarily Monday to Friday) and works two shifts a day (again, not necessarily): from 9am to 1pm and from 2pm to 6pm. Thanks in advance!

like image 324
Sammy Avatar asked Oct 16 '12 14:10

Sammy


2 Answers

{ "Hours" : 
    [ 
    { "Monday": 
        [
            { "Start": "0900", "Finish": "1300" },
            { "Start": "1400", "Finish": "1800" }
        ]
    },
    { "Tuesday":
        [
            { "Start": "0900", "Finish": "1300" },
            { "Start": "1400", "Finish": "1800" }
        ]
    },
    { "Wednesday":
        [
            { "Start": "0900", "Finish": "1300" },
            { "Start": "1400", "Finish": "1800" }
        ]
    },
    { "Thursday":
        [
            { "Start": "0900", "Finish": "1300" },
            { "Start": "1400", "Finish": "1800" }
        ]
    },
    { "Friday":
        [
            { "Start": "0900", "Finish": "1300" },
            { "Start": "1400", "Finish": "1800" }
        ]
    },
    { "Saturday":
        []
    },
    { "Sunday":
        []
    }
]
}
like image 50
st3inn Avatar answered Sep 22 '22 11:09

st3inn


Following is how Facebook saves the place times

"hours": {
    "mon_1_open": "12:00",
    "mon_1_close": "20:30",
    "tue_1_open": "12:00",
    "tue_1_close": "20:30",
    "wed_1_open": "12:00",
    "wed_1_close": "20:30",
    "thu_1_open": "12:00",
    "thu_1_close": "20:30",
    "fri_1_open": "12:00",
    "fri_1_close": "20:30",
    "sat_1_open": "12:00",
    "sat_1_close": "20:30",
    "sun_1_open": "12:00",
    "sun_1_close": "20:30"
  },
like image 40
Sahan Avatar answered Sep 24 '22 11:09

Sahan